public class TypeHierarchyBeanOperationParser extends Object implements BeanOperationParser
General implementation of BeanOperationParser.
When parsing the configuration, the parser will create a root BeanOperations
as the context for this execution, Then successively call all registered OperationAnnotationHandler
to collect the configuration information into the BeanOperations in context.
After the parsing is completed, the BeanOperations comparator
corresponding to the AnnotatedElement will be cached,
and the cache will be used preferentially for the next access.
When parsing element, if it is a:
Class: it will check all parent classes and interfaces in its hierarchy;Method: it will check for methods with the same method signature in all parent classes and interfaces in its hierarchy;The sequence of operations obtained through the parser follows:
OperationAnnotationHandler;OperationAnnotationHandler;BeanOperationExecutor.OperationAnnotationHandler| 限定符和类型 | 字段和说明 |
|---|---|
protected Map<AnnotatedElement,BeanOperations> |
currentlyInParsing
temp cache for operations of element that currently in parsing
|
protected boolean |
enableHierarchyCache
Whether to cache hierarchy operation info of element.
|
protected List<OperationAnnotationHandler> |
operationAnnotationHandlers
registered operation annotation resolvers.
|
protected Map<AnnotatedElement,BeanOperations> |
resolvedElements
finally cache for operations of resolved element.
|
protected Map<AnnotatedElement,BeanOperations> |
resolvedHierarchyElements
temp cache for operations of resolved element where in type hierarchy.
|
| 构造器和说明 |
|---|
TypeHierarchyBeanOperationParser() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addBeanOperationsResolver(OperationAnnotationHandler handler)
Add bean operations resolvers.
|
protected BeanOperations |
createBeanOperations(AnnotatedElement element)
Create
BeanOperations comparator |
protected Collection<BeanOperations> |
doParseForElement(AnnotatedElement element)
Parse operations form hierarchy of
element. |
protected Collection<BeanOperations> |
doParseForMethod(Method method)
Parse operations form method where in type hierarchy of
beanType. |
protected Collection<BeanOperations> |
doParseForType(Class<?> beanType)
Parse operations form type hierarchy of
beanType. |
@NonNull BeanOperations |
parse(AnnotatedElement element)
Parse the class and class attribute information,
and generate the corresponding
BeanOperations comparator. |
protected BeanOperations |
resolveToOperations(AnnotatedElement source)
Parse
BeanOperations from source if necessary. |
protected final Map<AnnotatedElement,BeanOperations> currentlyInParsing
protected final Map<AnnotatedElement,BeanOperations> resolvedHierarchyElements
protected final Map<AnnotatedElement,BeanOperations> resolvedElements
protected List<OperationAnnotationHandler> operationAnnotationHandlers
protected boolean enableHierarchyCache
public void addBeanOperationsResolver(OperationAnnotationHandler handler)
handler - handler@NonNull public @NonNull BeanOperations parse(AnnotatedElement element) throws OperationParseException
Parse the class and class attribute information,
and generate the corresponding BeanOperations comparator.
If there is a cache, it will be obtained from the cache first.
NOTE:The BeanOperations obtained may still be being parsed.
Please confirm whether it is ready through BeanOperations.isActive().
parse 在接口中 BeanOperationParserelement - element to parseBeanOperationsOperationParseException - thrown when configuration resolution exceptionprotected BeanOperations createBeanOperations(AnnotatedElement element)
BeanOperations comparatorelement - elementBeanOperationsprotected Collection<BeanOperations> doParseForElement(AnnotatedElement element)
element.element - elementelementresolveToOperations(java.lang.reflect.AnnotatedElement)protected Collection<BeanOperations> doParseForType(Class<?> beanType)
beanType.beanType - bean typebeanTyperesolveToOperations(java.lang.reflect.AnnotatedElement)protected Collection<BeanOperations> doParseForMethod(Method method)
beanType.method - methodbeanTyperesolveToOperations(java.lang.reflect.AnnotatedElement)protected final BeanOperations resolveToOperations(AnnotatedElement source)
BeanOperations from source if necessary.source - sourceCopyright © 2023. All rights reserved.