public final class DigesterLoader
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private AnnotationRuleProviderFactory |
annotationRuleProviderFactory |
private RuleSetCache |
cachedRuleSet
In-memory LRU cache that stores already analyzed classes and relative
RuleSet. |
private DigesterLoaderHandlerFactory |
digesterLoaderHandlerFactory |
| Modifier | Constructor and Description |
|---|---|
protected |
DigesterLoader(AnnotationRuleProviderFactory annotationRuleProviderFactory,
DigesterLoaderHandlerFactory digesterLoaderHandlerFactory)
Creates a new
DigesterLoader instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
addRules(java.lang.Class<?> target,
Digester digester)
Add rules to an already created Digester instance, analyzing the digester
annotations in the target class.
|
void |
addRulesTo(java.lang.Class<?> target,
FromAnnotationsRuleSet ruleSet)
Analyzes the target class and adds the
AnnotationRuleProviders to
the existing FromAnnotationsRuleSet. |
Digester |
createDigester(java.lang.Class<?> target)
Creates a new digester which rules are defined by analyzing the digester
annotations in the target class.
|
protected AnnotationRuleProviderFactory |
getAnnotationRuleProviderFactory() |
protected DigesterLoaderHandlerFactory |
getDigesterLoaderHandlerFactory() |
RuleSet |
getRuleSet(java.lang.Class<?> target)
Builds a new
RuleSet analyzing the digester annotations in the
target class. |
private <A extends java.lang.annotation.Annotation,E extends java.lang.reflect.AnnotatedElement,R extends Rule> |
handle(A annotation,
E element,
FromAnnotationsRuleSet ruleSet)
Handles the current visited element and related annotation, invoking the
right handler putting the rule provider in the rule set.
|
private void |
handle(java.lang.reflect.AnnotatedElement element,
FromAnnotationsRuleSet ruleSet)
Executes an analysis for each annotation present in the element.
|
private final RuleSetCache cachedRuleSet
RuleSet.private final AnnotationRuleProviderFactory annotationRuleProviderFactory
private final DigesterLoaderHandlerFactory digesterLoaderHandlerFactory
protected DigesterLoader(AnnotationRuleProviderFactory annotationRuleProviderFactory, DigesterLoaderHandlerFactory digesterLoaderHandlerFactory)
DigesterLoader instance.annotationRuleProviderFactory - digesterLoaderHandlerFactory - protected AnnotationRuleProviderFactory getAnnotationRuleProviderFactory()
protected DigesterLoaderHandlerFactory getDigesterLoaderHandlerFactory()
public Digester createDigester(java.lang.Class<?> target)
target - the class has to be analyzed.public void addRules(java.lang.Class<?> target,
Digester digester)
target - the class has to be analyzed.digester - the Digester instance reference.public RuleSet getRuleSet(java.lang.Class<?> target)
RuleSet analyzing the digester annotations in the
target class.
It avoids iterate the annotations analysis for already analyzed classes,
using an in-memory LRU cache.target - the class has to be analyzed.RuleSet.public void addRulesTo(java.lang.Class<?> target,
FromAnnotationsRuleSet ruleSet)
AnnotationRuleProviders to
the existing FromAnnotationsRuleSet.target - the class has to be analyzed.ruleSet - the RuleSet where adding the providers.private void handle(java.lang.reflect.AnnotatedElement element,
FromAnnotationsRuleSet ruleSet)
element - the current element under analysis.ruleSet - the ruleSet where add providers.private <A extends java.lang.annotation.Annotation,E extends java.lang.reflect.AnnotatedElement,R extends Rule> void handle(A annotation, E element, FromAnnotationsRuleSet ruleSet)
annotation - the current visited annotation.element - the current visited element.