标签:function ace stc present 集合 inter 获取 generics name
注解与反射:
//获取当前对象上所有的注解
Annotation[] annotations = obj.getClass().getAnnotations();
//获取当前对象上指定注解
RestController speciAnno = obj.getClass().getAnnotation(RestController.class);
//获取class对象的直接超类的
Type genericSuperclass = class1.getGenericSuperclass();
//获取class对象的所有接口的type集合
Type Type[] interfaceTypes = class1.getGenericInterfaces();
//判断是否被某个注解类修饰
boolean isAnnotationPresent = class1.isAnnotationPresent(Deprecated.class);
==========================================================================================================================
//获取字段上某指定注解
field.getAnnotation(FruitName.class);
//获取字段上所有注解
field.getAnnotations()
//判断当前字段上是否有注解
field.isAnnotationPresent()
==========================================================================================================================
//获取当前方法的所有注解
method.getAnnotations()
//获取方法的指定注解
Autowired uc = method.getAnnotation(Autowired.class);
//判断当前方法上是否有注解
method.isAnnotationPresent()
==========================================================================================================================
标签:function ace stc present 集合 inter 获取 generics name
原文地址:https://www.cnblogs.com/qlsty/p/12121094.html