Java 反射类:ReflexUtil
public class ReflexUtil {
static Logger logger = LoggerFactory.getLogger(ReflexUtil.class);
//getMethod
static public Object invokeMethod(String propertiesName, Object object) {
try {
if(object==null) return null;
if (!propertiesName.contains(".")) {
String methodName = "get"+getMethodName(propertiesName);
Method method = object.getClass().getMethod(methodName);
return method.invoke(object);
}
String methodName = "get"+getMethodName(propertiesName.substring(0,propertiesName.indexOf(".")));
Method method = object.getClass().getMethod(methodName);
return invokeMethod(propertiesName.substring(propertiesName.indexOf(".")+1), method.invoke(object));
} catch (Exception e) {