Class FromAnnotationsRuleSet
java.lang.Object
org.apache.commons.digester.annotations.FromAnnotationsRuleSet
- All Implemented Interfaces:
RuleSet
- Since:
- 2.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DigesterLoaderMaintains all the classes that this RuleSet produces mapping for.private StringThe namespace URI.private final Map<String, List<AnnotationRuleProvider<Annotation, AnnotatedElement, Rule>>> The data structure that stores the patterns/AnnotationRuleProviderpairs. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFromAnnotationsRuleSet(DigesterLoader digesterLoader) Created a newFromAnnotationsRuleSetinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddMappedClass(Class<?> clazz) Remember that this RuleSet is able to build Digester mapping rules for the input type.voidaddRuleInstances(Digester digester) Add the set of Rule instances defined in this RuleSet to the specifiedDigesterinstance, associating them with our namespace URI (if any).<A extends Annotation,E extends AnnotatedElement, R extends Rule, T extends AnnotationRuleProvider<A, E, R>>
voidaddRuleProvider(String pattern, Class<T> klass, A annotation, E element) Builds and register anAnnotationRuleProviderfor a specific pattern.voidaddRuleProvider(String pattern, AnnotationRuleProvider<? extends Annotation, ? extends AnnotatedElement, ? extends Rule> ruleProvider) Register anAnnotationRuleProviderfor a specific pattern.voidAnalyzes the target class and adds theAnnotationRuleProviders to thisFromAnnotationsRuleSet.voidAdd createdAnnotationRuleProviders created in another analysis session.Return the namespace URI that will be applied to all Rule instances created from this RuleSet.<T extends AnnotationRuleProvider<? extends Annotation,? extends AnnotatedElement, ? extends Rule>>
TgetProvider(String pattern, Class<T> providerClass) Retrieves a specific instance of theAnnotationRuleProviderfor the input pattern.private Map<String, List<AnnotationRuleProvider<Annotation, AnnotatedElement, Rule>>> getRules()Returns the data structure the patterns/AnnotationRuleProviderpairs.protected booleanChecks if this RuleSet builds Digester mapping rules for the input type.voidsetNamespaceURI(String namespaceURI) Sets the namespace URI that will be applied to all Rule instances created from this RuleSet.toString()
-
Field Details
-
rules
The data structure that stores the patterns/AnnotationRuleProviderpairs. -
mappedClasses
Maintains all the classes that this RuleSet produces mapping for. -
digesterLoader
-
namespaceURI
The namespace URI.
-
-
Constructor Details
-
FromAnnotationsRuleSet
Created a newFromAnnotationsRuleSetinstance.- Parameters:
digesterLoader- the parent DigesterLoader.
-
-
Method Details
-
addRuleInstances
Add the set of Rule instances defined in this RuleSet to the specifiedDigesterinstance, associating them with our namespace URI (if any). This method should only be called by a Digester instance.- Specified by:
addRuleInstancesin interfaceRuleSet- Parameters:
digester- Digester instance to which the new Rule instances should be added.
-
addRules
Analyzes the target class and adds theAnnotationRuleProviders to thisFromAnnotationsRuleSet.- Parameters:
target- the class has to be analyzed.
-
addRuleProvider
public <A extends Annotation,E extends AnnotatedElement, void addRuleProviderR extends Rule, T extends AnnotationRuleProvider<A, E, R>> (String pattern, Class<T> klass, A annotation, E element) Builds and register anAnnotationRuleProviderfor a specific pattern.- Type Parameters:
T- theAnnotationRuleProvidertype.- Parameters:
pattern- the pattern has to be associated to the rule provider.klass- theAnnotationRuleProvidertype has to be instantiated.annotation- the current visited annotation.element- the current visited element.
-
addRuleProvider
public void addRuleProvider(String pattern, AnnotationRuleProvider<? extends Annotation, ? extends AnnotatedElement, ? extends Rule> ruleProvider) Register anAnnotationRuleProviderfor a specific pattern.- Parameters:
pattern- the pattern has to be associated to the rule provider.ruleProvider- the provider that builds the digester rule.
-
getProvider
public <T extends AnnotationRuleProvider<? extends Annotation,? extends AnnotatedElement, T getProvider? extends Rule>> (String pattern, Class<T> providerClass) Retrieves a specific instance of theAnnotationRuleProviderfor the input pattern.- Type Parameters:
T- theAnnotationRuleProvidertype- Parameters:
pattern- the input patternproviderClass- theAnnotationRuleProviderclass- Returns:
- an
AnnotationRuleProviderfor the input pattern if found, null otherwise.
-
addRulesProviderFrom
Add createdAnnotationRuleProviders created in another analysis session.- Parameters:
ruleSet- theRuleSetcreated in another analysis session.
-
mapsClass
Checks if this RuleSet builds Digester mapping rules for the input type.- Parameters:
clazz- the input type.- Returns:
- true, if this RuleSet builds Digester mapping rules for the input type, false otherwise.
-
addMappedClass
Remember that this RuleSet is able to build Digester mapping rules for the input type.- Parameters:
clazz- the input type.
-
getRules
Returns the data structure the patterns/AnnotationRuleProviderpairs.- Returns:
- the data structure the patterns/
AnnotationRuleProviderpairs.
-
getNamespaceURI
Return the namespace URI that will be applied to all Rule instances created from this RuleSet.- Specified by:
getNamespaceURIin interfaceRuleSet
-
setNamespaceURI
Sets the namespace URI that will be applied to all Rule instances created from this RuleSet.- Parameters:
namespaceURI- the namespace URI that will be applied to all Rule instances created from this RuleSet.
-
toString
-