Java examples for Reflection:Setter
is setter Method
//package com.java2s; import java.lang.reflect.Method; public class Main { public static final int SET_START = "set".length(); public static boolean isSetter(Method method) { String name = method.getName(); boolean hasOneParam = method.getParameterTypes().length == 1; boolean startsWithGet = (name.length() > SET_START) && name.startsWith("set"); return startsWithGet && hasOneParam; }/*from w ww. j av a 2s . c o m*/ }