类 CombinationAnnotationElement
- java.lang.Object
-
- cc.shacocloud.mirage.utils.annotation.CombinationAnnotationElement
-
- 所有已实现的接口:
AnnotatedElementMetadata,AnnotatedElement
public class CombinationAnnotationElement extends Object implements AnnotatedElementMetadata
组合注解核心实现使用了递归获取指定元素上的注解以及注解的注解,以实现复合注解的获取。
-
-
构造器概要
构造器 构造器 说明 CombinationAnnotationElement(AnnotatedElement element)构造
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 <T extends Annotation>
TgetAnnotation(@NotNull Class<T> annotationClass)<A extends Annotation>
AnnotationAttributesgetAnnotationAttributes(Class<A> annotationType)获取指定注解的所有属性值Annotation[]getAnnotations()Annotation[]getDeclaredAnnotations()Class<? extends AnnotatedElement>getType()获取实际注解元素类型的Class引用<T,A extends Annotation>
Optional<T>getValue(Class<A> annotationType, String attributeName, Class<T> type)获取指定注解的属性值booleanisAnnotationPresent(@NotNull Class<? extends Annotation> annotationClass)-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 java.lang.reflect.AnnotatedElement
getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotationsByType
-
-
-
-
构造器详细资料
-
CombinationAnnotationElement
public CombinationAnnotationElement(AnnotatedElement element)
构造- 参数:
element- 需要解析注解的元素:可以是 Class、Method、Field、Constructor、ReflectPermission
-
-
方法详细资料
-
getAnnotationAttributes
public <A extends Annotation> AnnotationAttributes getAnnotationAttributes(Class<A> annotationType)
获取指定注解的所有属性值- 指定者:
getAnnotationAttributes在接口中AnnotatedElementMetadata- 类型参数:
A- 注解泛型- 参数:
annotationType- 注解类型- 返回:
AnnotationAttributes
-
getValue
public <T,A extends Annotation> Optional<T> getValue(Class<A> annotationType, String attributeName, Class<T> type)
获取指定注解的属性值- 指定者:
getValue在接口中AnnotatedElementMetadata- 类型参数:
T- 值类型泛型A- 注解泛型- 参数:
annotationType- 注解类型attributeName- 注解的属性type- 值类型- 返回:
-
getType
public Class<? extends AnnotatedElement> getType()
获取实际注解元素类型的Class引用
-
isAnnotationPresent
public boolean isAnnotationPresent(@NotNull @NotNull Class<? extends Annotation> annotationClass)- 指定者:
isAnnotationPresent在接口中AnnotatedElement
-
getAnnotation
public <T extends Annotation> T getAnnotation(@NotNull @NotNull Class<T> annotationClass)
- 指定者:
getAnnotation在接口中AnnotatedElement
-
getAnnotations
public Annotation[] getAnnotations()
- 指定者:
getAnnotations在接口中AnnotatedElement
-
getDeclaredAnnotations
public Annotation[] getDeclaredAnnotations()
- 指定者:
getDeclaredAnnotations在接口中AnnotatedElement
-
-