
top.jfunc.json.util.BeanInfoUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-jsonlib Show documentation
Show all versions of json-jsonlib Show documentation
common json interface implements by jsonlib
The newest version!
package top.jfunc.json.util;
import java.lang.reflect.Method;
public class BeanInfoUtil {
/**
* 根据field 找到相应的getter,可能返回null
*/
public static Method getGetter(Class> clazz , String fieldName){
String prop = fieldName.substring(0,1).toUpperCase() + fieldName.substring(1);
try {
return clazz.getMethod("get" + prop);
} catch (NoSuchMethodException e) {
try {
//boolean 类型的
return clazz.getMethod("is" + prop);
} catch (NoSuchMethodException e1) {
return null;
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy