Java examples for Reflection:Setter
get Setters Method from Class
import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; public class Main{ public static void main(String[] argv) throws Exception{ Class c = String.class; System.out.println(getSetters(c)); }/*from w ww. java 2 s . c o m*/ public static List<Method> getSetters(Class<?> c) { List<Method> ls = BeanAccess.getAllMethods(c); List<Method> ms = new ArrayList<Method>(); for (Method m : ls) { String n = m.getName(); int l = n.length(); if (l > 3 && n.startsWith("set")) { ms.add(m); } } return ms; } }