|
Questions ? Ask for FREE ! |
Being new at Java programming, please bear with me
Using reflection, I run into a problem I hope someone can help me with...
Field f = someClass.getDeclaredField("fieldName");
f.setaccessible(true);
Object fieldValue = f.get(someClass);
This is possible, but what if I don't want to use object but cast the result of f.get to a class... but this class is unknown till runtime; is that possible to do, and how should it be done?
Class x = anotherClass.newInstance();
x objectX = (x) f.get(someClass);
any help?
Asked in Java - 121 days ago
Tags: Help with reflection problem in Java
Report abuse|
Answer the Questions - Win Cool Prizes ! |
Categories