Modifier and Type | Field and Description |
---|---|
private DigesterLoader |
digesterLoader |
private java.util.Set<java.lang.Class<?>> |
mappedClasses
Maintains all the classes that this RuleSet produces mapping for.
|
private java.lang.String |
namespaceURI
The namespace URI.
|
private java.util.Map<java.lang.String,java.util.List<AnnotationRuleProvider<java.lang.annotation.Annotation,java.lang.reflect.AnnotatedElement,Rule>>> |
rules
The data structure that stores the patterns/
AnnotationRuleProvider
pairs. |
Modifier | Constructor and Description |
---|---|
protected |
FromAnnotationsRuleSet(DigesterLoader digesterLoader)
Created a new
FromAnnotationsRuleSet instance. |
Modifier and Type | Method and Description |
---|---|
protected void |
addMappedClass(java.lang.Class<?> clazz)
Remember that this RuleSet is able to build Digester mapping rules for
the input type.
|
void |
addRuleInstances(Digester digester)
Add the set of Rule instances defined in this RuleSet to the
specified
Digester instance, associating them with
our namespace URI (if any). |
void |
addRuleProvider(java.lang.String pattern,
AnnotationRuleProvider<? extends java.lang.annotation.Annotation,? extends java.lang.reflect.AnnotatedElement,? extends Rule> ruleProvider)
Register an
AnnotationRuleProvider for a specific pattern. |
<A extends java.lang.annotation.Annotation,E extends java.lang.reflect.AnnotatedElement,R extends Rule,T extends AnnotationRuleProvider<A,E,R>> |
addRuleProvider(java.lang.String pattern,
java.lang.Class<T> klass,
A annotation,
E element)
Builds and register an
AnnotationRuleProvider for a specific
pattern. |
void |
addRules(java.lang.Class<?> target)
Analyzes the target class and adds the
AnnotationRuleProvider s to
this FromAnnotationsRuleSet . |
void |
addRulesProviderFrom(FromAnnotationsRuleSet ruleSet)
Add created
AnnotationRuleProvider s created in another analysis
session. |
java.lang.String |
getNamespaceURI()
Return the namespace URI that will be applied to all Rule instances
created from this RuleSet.
|
<T extends AnnotationRuleProvider<? extends java.lang.annotation.Annotation,? extends java.lang.reflect.AnnotatedElement,? extends Rule>> |
getProvider(java.lang.String pattern,
java.lang.Class<T> providerClass)
Retrieves a specific instance of the
AnnotationRuleProvider for
the input pattern. |
private java.util.Map<java.lang.String,java.util.List<AnnotationRuleProvider<java.lang.annotation.Annotation,java.lang.reflect.AnnotatedElement,Rule>>> |
getRules()
Returns the data structure the patterns/
AnnotationRuleProvider
pairs. |
protected boolean |
mapsClass(java.lang.Class<?> clazz)
Checks if this RuleSet builds Digester mapping rules for the input type.
|
void |
setNamespaceURI(java.lang.String namespaceURI)
Sets the namespace URI that will be applied to all Rule instances
created from this RuleSet.
|
java.lang.String |
toString() |
private final java.util.Map<java.lang.String,java.util.List<AnnotationRuleProvider<java.lang.annotation.Annotation,java.lang.reflect.AnnotatedElement,Rule>>> rules
AnnotationRuleProvider
pairs.private final java.util.Set<java.lang.Class<?>> mappedClasses
private final DigesterLoader digesterLoader
private volatile java.lang.String namespaceURI
protected FromAnnotationsRuleSet(DigesterLoader digesterLoader)
FromAnnotationsRuleSet
instance.digesterLoader
- the parent DigesterLoader.public void addRuleInstances(Digester digester)
Digester
instance, associating them with
our namespace URI (if any). This method should only be called
by a Digester instance.addRuleInstances
in interface RuleSet
digester
- Digester instance to which the new Rule instances
should be added.public void addRules(java.lang.Class<?> target)
AnnotationRuleProvider
s to
this FromAnnotationsRuleSet
.target
- the class has to be analyzed.public <A extends java.lang.annotation.Annotation,E extends java.lang.reflect.AnnotatedElement,R extends Rule,T extends AnnotationRuleProvider<A,E,R>> void addRuleProvider(java.lang.String pattern, java.lang.Class<T> klass, A annotation, E element)
AnnotationRuleProvider
for a specific
pattern.T
- the AnnotationRuleProvider
type.pattern
- the pattern has to be associated to the rule provider.klass
- the AnnotationRuleProvider
type has to be instantiated.annotation
- the current visited annotation.element
- the current visited element.public void addRuleProvider(java.lang.String pattern, AnnotationRuleProvider<? extends java.lang.annotation.Annotation,? extends java.lang.reflect.AnnotatedElement,? extends Rule> ruleProvider)
AnnotationRuleProvider
for a specific pattern.pattern
- the pattern has to be associated to the rule provider.ruleProvider
- the provider that builds the digester rule.public <T extends AnnotationRuleProvider<? extends java.lang.annotation.Annotation,? extends java.lang.reflect.AnnotatedElement,? extends Rule>> T getProvider(java.lang.String pattern, java.lang.Class<T> providerClass)
AnnotationRuleProvider
for
the input pattern.T
- the AnnotationRuleProvider
typepattern
- the input patternproviderClass
- the AnnotationRuleProvider
classAnnotationRuleProvider
for the input pattern if found,
null otherwise.public void addRulesProviderFrom(FromAnnotationsRuleSet ruleSet)
AnnotationRuleProvider
s created in another analysis
session.ruleSet
- the RuleSet
created in another analysis session.protected boolean mapsClass(java.lang.Class<?> clazz)
clazz
- the input type.protected void addMappedClass(java.lang.Class<?> clazz)
clazz
- the input type.private java.util.Map<java.lang.String,java.util.List<AnnotationRuleProvider<java.lang.annotation.Annotation,java.lang.reflect.AnnotatedElement,Rule>>> getRules()
AnnotationRuleProvider
pairs.AnnotationRuleProvider
pairs.public java.lang.String getNamespaceURI()
getNamespaceURI
in interface RuleSet
public void setNamespaceURI(java.lang.String namespaceURI)
namespaceURI
- the namespace URI that will be applied to all Rule
instances created from this RuleSet.public java.lang.String toString()
toString
in class java.lang.Object