public class CacheableSynthesizedAnnotationAttributeProcessor extends Object implements SynthesizedAnnotationAttributeProcessor
带缓存功能的SynthesizedAnnotationAttributeProcessor实现,
构建时需要传入比较器,获取属性值时将根据比较器对合成注解进行排序,
然后选择具有所需属性的,排序最靠前的注解用于获取属性值
通过该处理器获取合成注解属性值时会出现隐式别名,
即子注解和元注解中同时存在类型和名称皆相同的属性时,元注解中属性总是会被该属性覆盖,
并且该覆盖关系并不会通过Alias或Link被传递到关联的属性中。
| Constructor and Description |
|---|
CacheableSynthesizedAnnotationAttributeProcessor()
创建一个带缓存的注解值选择器,
默认按
SynthesizedAnnotation.getVerticalDistance()和SynthesizedAnnotation.getHorizontalDistance()排序,
越靠前的越优先被取值。 |
CacheableSynthesizedAnnotationAttributeProcessor(Comparator<Hierarchical> annotationComparator)
创建一个带缓存的注解值选择器
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getAttributeValue(String attributeName,
Class<T> attributeType,
Collection<? extends SynthesizedAnnotation> synthesizedAnnotations)
从一批被合成注解中,获取指定名称与类型的属性值
|
public CacheableSynthesizedAnnotationAttributeProcessor(Comparator<Hierarchical> annotationComparator)
annotationComparator - 注解比较器,排序更靠前的注解将被优先用于获取值public CacheableSynthesizedAnnotationAttributeProcessor()
SynthesizedAnnotation.getVerticalDistance()和SynthesizedAnnotation.getHorizontalDistance()排序,
越靠前的越优先被取值。public <T> T getAttributeValue(String attributeName, Class<T> attributeType, Collection<? extends SynthesizedAnnotation> synthesizedAnnotations)
SynthesizedAnnotationAttributeProcessorgetAttributeValue in interface SynthesizedAnnotationAttributeProcessorT - 属性类型attributeName - 属性名称attributeType - 属性类型synthesizedAnnotations - 被合成的注解Copyright © 2025. All rights reserved.