Package org.aoju.bus.core.scanner
Class CacheableProcessor
java.lang.Object
org.aoju.bus.core.scanner.CacheableProcessor
- All Implemented Interfaces:
SynthesizedProcessor
带缓存功能的
SynthesizedProcessor实现, 构建时需要传入比较器,获取属性值时将根据比较器对合成注解进行排序, 然后选择具有所需属性的,排序最靠前的注解用于获取属性值- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
ConstructorsConstructorDescriptionCacheableProcessor(Comparator<Synthesized> annotationComparator) 创建一个带缓存的注解值选择器 -
Method Summary
Modifier and TypeMethodDescription<T> TgetAttributeValue(String attributeName, Class<T> attributeType, Collection<? extends Synthesized> synthesizedAnnotations) 从一批被合成注解中,获取指定名称与类型的属性值
-
Constructor Details
-
CacheableProcessor
创建一个带缓存的注解值选择器- Parameters:
annotationComparator- 注解比较器,排序更靠前的注解将被优先用于获取值
-
-
Method Details
-
getAttributeValue
public <T> T getAttributeValue(String attributeName, Class<T> attributeType, Collection<? extends Synthesized> synthesizedAnnotations) Description copied from interface:SynthesizedProcessor从一批被合成注解中,获取指定名称与类型的属性值- Specified by:
getAttributeValuein interfaceSynthesizedProcessor- Type Parameters:
T- 属性类型- Parameters:
attributeName- 属性名称attributeType- 属性类型synthesizedAnnotations- 被合成的注解- Returns:
- 属性值
-