Class FromBinderRuleSet
- java.lang.Object
-
- org.apache.commons.digester3.binder.FromBinderRuleSet
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classFromBinderRuleSet.KeyUsed to associate pattern/namespaceURI
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<AbstractBackToLinkedRuleBuilder<? extends Rule>>providersThe data structure where storing the providers binding.private java.util.Map<FromBinderRuleSet.Key,java.util.Collection<AbstractBackToLinkedRuleBuilder<? extends Rule>>>providersIndexIndex for quick-retrieve provider.
-
Constructor Summary
Constructors Constructor Description FromBinderRuleSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRuleInstances(Digester digester)Add the set of Rule instances defined in this RuleSet to the specifiedDigesterinstance, associating them with our namespace URI (if any).voidclear()Clean the provider index.java.lang.StringgetNamespaceURI()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 ofRuleProviderassignable 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 ofRuleProviderassignable to the input type. This method is useful for rules that requires be unique in the pattern, likeSetPropertiesRuleandSetNestedPropertiesRule.- 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 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.
-
getNamespaceURI
public java.lang.String getNamespaceURI()
Return the namespace URI that will be applied to all Rule instances created from this RuleSet.- Specified by:
getNamespaceURIin interfaceRuleSet- Returns:
- the namespace URI that will be applied to all Rule instances created from this RuleSet
-
-