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 class
Used 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 TypeMethodDescriptionvoid
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.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 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 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 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
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
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
-