Interface AnnotationMapping<T extends Annotation>
- Type Parameters:
T- 注解类型
- All Superinterfaces:
Annotation
- All Known Implementing Classes:
GenericAnnotationMapping,ResolvedAnnotationMapping
用于增强注解的包装器
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault Class<? extends Annotation> 获取注解类型获取注解对象Method[]获取注解原始属性<R> RgetAttributeValue(String attributeName, Class<R> attributeType) 获取属性值根据当前映射对象,通过动态代理生成一个类型与被包装注解对象一致地合成注解,该注解相对原生注解: 支持同注解内通过Alias构建的别名机制; 支持子注解对元注解的同名同类型属性覆盖机制; 当isResolved()为false时,则该方法应当被包装的原始注解对象, 即返回值应当与getAnnotation()相同。<R> RgetResolvedAttributeValue(String attributeName, Class<R> attributeType) 获取解析后的属性值boolean当前注解是否存在被解析的属性,当该值为false时, 通过getResolvedAttributeValue获得的值皆为注解的原始属性值, 通过getResolvedAnnotation()获得注解对象为原始的注解对象。booleanisRoot()当前注解是否为根注解Methods inherited from interface java.lang.annotation.Annotation
equals, hashCode, toString
-
Method Details
-
isRoot
boolean isRoot()当前注解是否为根注解- Returns:
- 是否
-
getAnnotation
T getAnnotation()获取注解对象- Returns:
- 注解对象
-
getResolvedAnnotation
T getResolvedAnnotation()根据当前映射对象,通过动态代理生成一个类型与被包装注解对象一致地合成注解,该注解相对原生注解:- 支持同注解内通过
Alias构建的别名机制; - 支持子注解对元注解的同名同类型属性覆盖机制;
isResolved()为false时,则该方法应当被包装的原始注解对象, 即返回值应当与getAnnotation()相同。- Returns:
- 所需的注解,若
isResolved()为false则返回的是原始的注解对象
- 支持同注解内通过
-
annotationType
获取注解类型- Specified by:
annotationTypein interfaceAnnotation- Returns:
- 注解类型
-
isResolved
boolean isResolved()当前注解是否存在被解析的属性,当该值为false时, 通过getResolvedAttributeValue获得的值皆为注解的原始属性值, 通过getResolvedAnnotation()获得注解对象为原始的注解对象。- Returns:
- 是否
-
getAttributes
Method[] getAttributes()获取注解原始属性- Returns:
- 注解属性
-
getAttributeValue
获取属性值- Type Parameters:
R- 返回值类型- Parameters:
attributeName- 属性名称attributeType- 属性类型- Returns:
- 属性值
-
getResolvedAttributeValue
获取解析后的属性值- Type Parameters:
R- 返回值类型- Parameters:
attributeName- 属性名称attributeType- 属性类型- Returns:
- 属性值
-