Class FromAnnotationsRuleModule
- java.lang.Object
-
- org.apache.commons.digester3.binder.AbstractRulesModule
-
- org.apache.commons.digester3.annotations.FromAnnotationsRuleModule
-
- All Implemented Interfaces:
RulesModule
public abstract class FromAnnotationsRuleModule extends AbstractRulesModule
RulesModule
implementation that allows loading rules from annotated classes.- Since:
- 3.0
-
-
Field Summary
Fields Modifier and Type Field Description private AnnotationHandlerFactory
annotationHandlerFactory
private static AnnotationHandlerFactory
DEFAULT_HANDLER_FACTORY
private static java.lang.String
JAVA_PACKAGE
private WithMemoryRulesBinder
rulesBinder
-
Constructor Summary
Constructors Constructor Description FromAnnotationsRuleModule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
bindRulesFrom(java.lang.Class<?> type)
Scan the input Class, looking for Digester rules expressed via annotations, and binds them.protected void
configure()
Configures aRulesBinder
via the exposed methods.protected abstract void
configureRules()
Configures aRulesBinder
via the exposed methods.private <A extends java.lang.annotation.Annotation,E extends java.lang.reflect.AnnotatedElement,R extends Rule>
voidhandle(A annotation, E element)
Handles the current visited element and related annotation, invoking the right handler putting the rule provider in the rule set.protected void
useAnnotationHandlerFactory(AnnotationHandlerFactory annotationHandlerFactory)
Allows users plug a differentAnnotationHandlerFactory
to createAnnotationHandler
instances.protected void
useDefaultAnnotationHandlerFactory()
Allows users to switch back to the defaultAnnotationHandlerFactory
implementation.private void
visitElements(java.lang.reflect.AnnotatedElement... annotatedElements)
private <AE extends java.lang.reflect.AnnotatedElement>
voidvisitElements(java.security.PrivilegedAction<AE[]> action)
-
Methods inherited from class org.apache.commons.digester3.binder.AbstractRulesModule
addError, addError, configure, forPattern, install, rulesBinder
-
-
-
-
Field Detail
-
JAVA_PACKAGE
private static final java.lang.String JAVA_PACKAGE
- See Also:
- Constant Field Values
-
DEFAULT_HANDLER_FACTORY
private static final AnnotationHandlerFactory DEFAULT_HANDLER_FACTORY
-
annotationHandlerFactory
private AnnotationHandlerFactory annotationHandlerFactory
-
rulesBinder
private WithMemoryRulesBinder rulesBinder
-
-
Method Detail
-
configure
protected final void configure()
Configures aRulesBinder
via the exposed methods.- Specified by:
configure
in classAbstractRulesModule
-
configureRules
protected abstract void configureRules()
Configures aRulesBinder
via the exposed methods.
-
useAnnotationHandlerFactory
protected final void useAnnotationHandlerFactory(AnnotationHandlerFactory annotationHandlerFactory)
Allows users plug a differentAnnotationHandlerFactory
to createAnnotationHandler
instances.- Parameters:
annotationHandlerFactory
- A customAnnotationHandlerFactory
to createAnnotationHandler
instances
-
useDefaultAnnotationHandlerFactory
protected final void useDefaultAnnotationHandlerFactory()
Allows users to switch back to the defaultAnnotationHandlerFactory
implementation.
-
bindRulesFrom
protected final void bindRulesFrom(java.lang.Class<?> type)
Scan the input Class, looking for Digester rules expressed via annotations, and binds them.- Parameters:
type
- the type has to be analyzed- See Also:
DigesterRule
-
visitElements
private <AE extends java.lang.reflect.AnnotatedElement> void visitElements(java.security.PrivilegedAction<AE[]> action)
- Type Parameters:
AE
-- Parameters:
action
-
-
visitElements
private void visitElements(java.lang.reflect.AnnotatedElement... annotatedElements)
- Parameters:
annotatedElements
-
-
handle
private <A extends java.lang.annotation.Annotation,E extends java.lang.reflect.AnnotatedElement,R extends Rule> void handle(A annotation, E element)
Handles the current visited element and related annotation, invoking the right handler putting the rule provider in the rule set.- Parameters:
annotation
- the current visited annotation.element
- the current visited element.
-
-