java反射获取所有表字段的注解信息

java 文章 2020-09-14 13:38 951 0 全屏看文

AI助手支持GPT4.0

public static List<String>  getTransientFiled(Object o) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException{
	Class<?> clazz = o.getClass();
	Field [] fs =  clazz.getDeclaredFields();
	List<String> transientList = new ArrayList<String>();
	
	for(Field f : fs){
		Annotation [] ans =  f.getAnnotations();
		for(Annotation an : ans){
			System.out.println(an.toString()+" "+f.getName());
		}
	}
	return transientList;
}



-EOF-

AI助手支持GPT4.0