Class DefaultRulesBinder
- java.lang.Object
-
- org.apache.commons.digester3.binder.DefaultRulesBinder
-
- All Implemented Interfaces:
RulesBinder
final class DefaultRulesBinder extends java.lang.Object implements RulesBinder
The default Digester EDSL implementation.- Since:
- 3.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ClassLoaderclassLoaderprivate java.util.List<ErrorMessage>errorsErrors that can occur during binding time or rules creation.private FromBinderRuleSetfromBinderRuleSet
-
Constructor Summary
Constructors Constructor Description DefaultRulesBinder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddError(java.lang.String messagePattern, java.lang.Object... arguments)Records an error message which will be presented to the user at a later time.voidaddError(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.private voidaddError(ErrorMessage errorMessage)Records an error, the full details of which will be logged, and the message of which will be presented to the user at a later time.(package private) interrorsSize()LinkedRuleBuilderforPattern(java.lang.String pattern)Allows to associate the given pattern to one or more Digester rules.java.lang.ClassLoadergetContextClassLoader()Returns the contextClassLoader.(package private) java.lang.Iterable<ErrorMessage>getErrors()(package private) RuleSetgetFromBinderRuleSet()(package private) booleanhasError()(package private) voidinitialize(java.lang.ClassLoader classLoader)voidinstall(RulesModule rulesModule)Allows sub-modules inclusion while binding rules.
-
-
-
Field Detail
-
errors
private final java.util.List<ErrorMessage> errors
Errors that can occur during binding time or rules creation.
-
fromBinderRuleSet
private final FromBinderRuleSet fromBinderRuleSet
-
classLoader
private java.lang.ClassLoader classLoader
-
-
Method Detail
-
initialize
void initialize(java.lang.ClassLoader classLoader)
- Parameters:
classLoader-
-
getContextClassLoader
public java.lang.ClassLoader getContextClassLoader()
Returns the contextClassLoader.- Specified by:
getContextClassLoaderin 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:
addErrorin 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:
addErrorin interfaceRulesBinder- Parameters:
t- The exception has to be recorded.
-
addError
private void addError(ErrorMessage errorMessage)
Records an error, the full details of which will be logged, and the message of which will be presented to the user at a later time.- Parameters:
errorMessage- The error to record.
-
install
public void install(RulesModule rulesModule)
Allows sub-modules inclusion while binding rules.- Specified by:
installin 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:
forPatternin interfaceRulesBinder- Parameters:
pattern- The pattern that this rule should match- Returns:
- The Digester rules builder
-
hasError
boolean hasError()
- Returns:
-
errorsSize
int errorsSize()
- Returns:
-
getErrors
java.lang.Iterable<ErrorMessage> getErrors()
- Returns:
-
getFromBinderRuleSet
RuleSet getFromBinderRuleSet()
- Returns:
-
-