Class FromBinderRuleSet
- java.lang.Object
-
- org.apache.commons.digester3.binder.FromBinderRuleSet
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
FromBinderRuleSet.Key
Used to associate pattern/namespaceURI
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<AbstractBackToLinkedRuleBuilder<? extends Rule>>
providers
The data structure where storing the providers binding.private java.util.Map<FromBinderRuleSet.Key,java.util.Collection<AbstractBackToLinkedRuleBuilder<? extends Rule>>>
providersIndex
Index for quick-retrieve provider.
-
Constructor Summary
Constructors Constructor Description FromBinderRuleSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRuleInstances(Digester digester)
Add the set of Rule instances defined in this RuleSet to the specifiedDigester
instance, associating them with our namespace URI (if any).void
clear()
Clean the provider index.java.lang.String
getNamespaceURI()
Return the namespace URI that will be applied to all Rule instances created from this RuleSet.<R extends Rule,RB extends AbstractBackToLinkedRuleBuilder<R>>
RBgetProvider(java.lang.String keyPattern, java.lang.String namespaceURI, java.lang.Class<RB> type)
Returns the first instance ofRuleProvider
assignable to the input type.<R extends Rule,RB extends AbstractBackToLinkedRuleBuilder<R>>
voidregisterProvider(RB ruleBuilder)
Register the given rule builder and returns it.
-
-
-
Field Detail
-
providers
private final java.util.Collection<AbstractBackToLinkedRuleBuilder<? extends Rule>> providers
The data structure where storing the providers binding.
-
providersIndex
private final java.util.Map<FromBinderRuleSet.Key,java.util.Collection<AbstractBackToLinkedRuleBuilder<? extends Rule>>> providersIndex
Index for quick-retrieve provider.
-
-
Method Detail
-
registerProvider
public <R extends Rule,RB extends AbstractBackToLinkedRuleBuilder<R>> void registerProvider(RB ruleBuilder)
Register the given rule builder and returns it.- Type Parameters:
R
- The Digester rule typeRB
- The Digester rule builder type- Parameters:
ruleBuilder
- The input rule builder instance.
-
getProvider
public <R extends Rule,RB extends AbstractBackToLinkedRuleBuilder<R>> RB getProvider(java.lang.String keyPattern, java.lang.String namespaceURI, java.lang.Class<RB> type)
Returns the first instance ofRuleProvider
assignable to the input type. This method is useful for rules that requires be unique in the pattern, likeSetPropertiesRule
andSetNestedPropertiesRule
.- Type Parameters:
R
- The Digester rule typeRB
- The Digester rule builder type- Parameters:
keyPattern
- the rule patternnamespaceURI
- the namespace URI (can be null)type
- the rule builder type the client is looking for- Returns:
- the rule builder of input type, if any
-
clear
public void clear()
Clean the provider index.
-
addRuleInstances
public void addRuleInstances(Digester digester)
Add the set of Rule instances defined in this RuleSet to the specifiedDigester
instance, associating them with our namespace URI (if any). This method should only be called by a Digester instance.- Specified by:
addRuleInstances
in interfaceRuleSet
- Parameters:
digester
- Digester instance to which the new Rule instances should be added.
-
getNamespaceURI
public java.lang.String getNamespaceURI()
Return the namespace URI that will be applied to all Rule instances created from this RuleSet.- Specified by:
getNamespaceURI
in interfaceRuleSet
- Returns:
- the namespace URI that will be applied to all Rule instances created from this RuleSet
-
-