Class WithMemoryRulesBinder
- java.lang.Object
-
- org.apache.commons.digester3.annotations.WithMemoryRulesBinder
-
- All Implemented Interfaces:
RulesBinder
final class WithMemoryRulesBinder extends java.lang.Object implements RulesBinder
ARulesBinder
implementation with memory to maintain which classes have already been analyzed.- Since:
- 3.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<java.lang.Class<?>>
boundClasses
Maintains all the classes that this RuleSet produces mapping for.private RulesBinder
wrappedRulesBinder
-
Constructor Summary
Constructors Constructor Description WithMemoryRulesBinder(RulesBinder wrappedRulesBinder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addError(java.lang.String messagePattern, java.lang.Object... arguments)
Records an error message which will be presented to the user at a later time.void
addError(java.lang.Throwable t)
Records an exception, the full details of which will be logged, and the message of which will be presented to the user at a later time.LinkedRuleBuilder
forPattern(java.lang.String pattern)
Allows to associate the given pattern to one or more Digester rules.java.lang.ClassLoader
getContextClassLoader()
Returns the contextClassLoader
.void
install(RulesModule rulesModule)
Allows sub-modules inclusion while binding rules.boolean
isAlreadyBound(java.lang.Class<?> bindingClass)
boolean
markAsBound(java.lang.Class<?> bindingClass)
-
-
-
Field Detail
-
boundClasses
private final java.util.Set<java.lang.Class<?>> boundClasses
Maintains all the classes that this RuleSet produces mapping for.
-
wrappedRulesBinder
private final RulesBinder wrappedRulesBinder
-
-
Constructor Detail
-
WithMemoryRulesBinder
public WithMemoryRulesBinder(RulesBinder wrappedRulesBinder)
-
-
Method Detail
-
getContextClassLoader
public java.lang.ClassLoader getContextClassLoader()
Returns the contextClassLoader
.- Specified by:
getContextClassLoader
in interfaceRulesBinder
- Returns:
- The context
ClassLoader
-
addError
public void addError(java.lang.String messagePattern, java.lang.Object... arguments)
Records an error message which will be presented to the user at a later time. Unlike throwing an exception, this enable us to continue configuring the Digester and discover more errors. UsesString.format(String, Object[])
to insert the arguments into the message.- Specified by:
addError
in interfaceRulesBinder
- Parameters:
messagePattern
- The message string patternarguments
- Arguments referenced by the format specifiers in the format string
-
addError
public void addError(java.lang.Throwable t)
Records an exception, the full details of which will be logged, and the message of which will be presented to the user at a later time. If your Module calls something that you worry may fail, you should catch the exception and pass it into this.- Specified by:
addError
in interfaceRulesBinder
- Parameters:
t
- The exception has to be recorded.
-
install
public void install(RulesModule rulesModule)
Allows sub-modules inclusion while binding rules.- Specified by:
install
in interfaceRulesBinder
- Parameters:
rulesModule
- the sub-module has to be included.
-
forPattern
public LinkedRuleBuilder forPattern(java.lang.String pattern)
Allows to associate the given pattern to one or more Digester rules.- Specified by:
forPattern
in interfaceRulesBinder
- Parameters:
pattern
- The pattern that this rule should match- Returns:
- The Digester rules builder
-
markAsBound
public boolean markAsBound(java.lang.Class<?> bindingClass)
- Parameters:
bindingClass
-- Returns:
- true if the specified element has not yet been marked
-
isAlreadyBound
public boolean isAlreadyBound(java.lang.Class<?> bindingClass)
- Parameters:
bindingClass
-- Returns:
- true if the specified element has been marked
-
-