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
RulesModuleimplementation that allows loading rules from annotated classes.- Since:
- 3.0
-
-
Field Summary
Fields Modifier and Type Field Description private AnnotationHandlerFactoryannotationHandlerFactoryprivate static AnnotationHandlerFactoryDEFAULT_HANDLER_FACTORYprivate static java.lang.StringJAVA_PACKAGEprivate WithMemoryRulesBinderrulesBinder
-
Constructor Summary
Constructors Constructor Description FromAnnotationsRuleModule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidbindRulesFrom(java.lang.Class<?> type)Scan the input Class, looking for Digester rules expressed via annotations, and binds them.protected voidconfigure()Configures aRulesBindervia the exposed methods.protected abstract voidconfigureRules()Configures aRulesBindervia 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 voiduseAnnotationHandlerFactory(AnnotationHandlerFactory annotationHandlerFactory)Allows users plug a differentAnnotationHandlerFactoryto createAnnotationHandlerinstances.protected voiduseDefaultAnnotationHandlerFactory()Allows users to switch back to the defaultAnnotationHandlerFactoryimplementation.private voidvisitElements(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 aRulesBindervia the exposed methods.- Specified by:
configurein classAbstractRulesModule
-
configureRules
protected abstract void configureRules()
Configures aRulesBindervia the exposed methods.
-
useAnnotationHandlerFactory
protected final void useAnnotationHandlerFactory(AnnotationHandlerFactory annotationHandlerFactory)
Allows users plug a differentAnnotationHandlerFactoryto createAnnotationHandlerinstances.- Parameters:
annotationHandlerFactory- A customAnnotationHandlerFactoryto createAnnotationHandlerinstances
-
useDefaultAnnotationHandlerFactory
protected final void useDefaultAnnotationHandlerFactory()
Allows users to switch back to the defaultAnnotationHandlerFactoryimplementation.
-
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.
-
-