Class FromBinderRuleSet
java.lang.Object
org.apache.commons.digester3.binder.FromBinderRuleSet
- All Implemented Interfaces:
RuleSet
- Since:
- 3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classUsed to associate pattern/namespaceURI -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Collection<AbstractBackToLinkedRuleBuilder<? extends Rule>> The data structure where storing the providers binding.private final Map<FromBinderRuleSet.Key, Collection<AbstractBackToLinkedRuleBuilder<? extends Rule>>> Index for quick-retrieve provider. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRuleInstances(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.Return the namespace URI that will be applied to all Rule instances created from this RuleSet.<R extends Rule, RB extends AbstractBackToLinkedRuleBuilder<R>>
RBgetProvider(String keyPattern, String namespaceURI, 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 Details
-
providers
The data structure where storing the providers binding. -
providersIndex
private final Map<FromBinderRuleSet.Key, Collection<AbstractBackToLinkedRuleBuilder<? extends Rule>>> providersIndexIndex for quick-retrieve provider.
-
-
Constructor Details
-
FromBinderRuleSet
FromBinderRuleSet()
-
-
Method Details
-
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(String keyPattern, String namespaceURI, 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
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
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
-