mardi 30 décembre 2014

how to perform typecastng at runtime in java?

i am trying to make a client for services exposed through REST.I have multiple number of classes extending a single class.


Now when i send the request and get a response,every time i need to type cast the response for specific class.i am trying to automate this process,can this be achieved at run time?


I am thinking of using generics and reflection but unable to move forward.what i exactly want to achieve is by just mentioning a unique string or say request,i must be able to get exact same response without type casting it with that particular response class.


i know this is not much,but any help is appreciated.Thanks in advance.






Aucun commentaire:

Enregistrer un commentaire