getters and setters methods using Reflection

Hi,Can some one please provide me the code for getters and stters using reflection concept.Thanks,
[119 byte] By [kanth218a] at [2007-10-2 21:19:21]
# 1

it all starts with a Class object, which is returned from an object using the getClass() method. from there, you can inspect the methods in the class. the following code will get you started. note that you need to import java.lang.reflect.Method

Class clazz = obj.getClass();

for(Method method: clazz.getDeclaredMethods()) {

if ( method.getName().startsWith("get")) {

// handle that situation

}

if ( method.getName().startsWith("set")) {

// handle that situation

}

}

georgemca at 2007-7-14 0:28:34 > top of Java-index,Core,Core APIs...