1 |
First one invokes for any Object obj
-
Class cl = obj.getClass()
|
2 |
Second process instance cl of class Class, has methods
-
public Field[] getFields() returns all fields in object
-
public Method[] getMethods() returns all methods in object
-
public Constructor[] getConstructors() returns constructors
|
3 |
These return public instances only
|
4 |
Thirdly process arrays like Field, Method, Constructor etc. which are in java.lang.reflect and have a whole set of methods to find out further information including
-
fl =Field[0]
-
fl.getName() obtains name
-
fl.get(Object obj) gets value of field
-
fl.set(Object obj) sets value of field
-
fl.getType() is type of field etc.
|