Regarding Java Reflection API
Posted on 2004-08-31
I am newbie to java reflection API. could u please give me some valuable pointers to understand them??
public static void main(String s)
test(new String("Hi there"));
static void test(Object o)
//at this pointer I don't know what are the data and method members of that object
// I can go for instanceof but the problem is at runtime if i have multiple classes then it would be problem for
// writing such codes as it deals with multiple if and else conditions
//If I go with object.getClass() that will be faster for me. But my problem is
// how to work with data and method members of object
//I know I have method called class.getMethods() in Class
//But when it comes to runtime I am not understaindg How to execute that runtime methods.
// in otherwords I wanted to have following type of example for an example
// String str=(String)(class.getMethods()).substring(0,10);
I hope you understand my query