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 Details

  • Constructor Details

    • FromAnnotationsRuleModule

      public FromAnnotationsRuleModule()
  • Method Details

    • configure

      protected final void configure()
      Configures a RulesBinder via the exposed methods.
      Specified by:
      configure in class AbstractRulesModule
    • configureRules

      protected abstract void configureRules()
      Configures a RulesBinder via the exposed methods.
    • useAnnotationHandlerFactory

      protected final void useAnnotationHandlerFactory(AnnotationHandlerFactory annotationHandlerFactory)
      Allows users plug a different AnnotationHandlerFactory to create AnnotationHandler instances.
      Parameters:
      annotationHandlerFactory - A custom AnnotationHandlerFactory to create AnnotationHandler instances
    • useDefaultAnnotationHandlerFactory

      protected final void useDefaultAnnotationHandlerFactory()
      Allows users to switch back to the default AnnotationHandlerFactory implementation.
    • bindRulesFrom

      protected final void bindRulesFrom(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:
    • visitElements

      private <AE extends AnnotatedElement> void visitElements(PrivilegedAction<AE[]> action)
      Type Parameters:
      AE -
      Parameters:
      action -
    • visitElements

      private void visitElements(AnnotatedElement... annotatedElements)
      Parameters:
      annotatedElements -
    • handle

      private <A extends Annotation, E extends 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.