how to typecast the objects created by newInstance() method of reflection API in java dynamically -
how can create , clone , typecast object?
public int createobjec(object object, string classname) { //object may user, role or userrole // classname name of class sessionfactory.getcurrentsession().save(dynamicobject); //dynamicobject may user, role or userrole }
a better solution have factory handling object creation. depending on classname, create correct type in factory.
Comments
Post a Comment