Class FromAnnotationsRuleModule

  • All Implemented Interfaces:
    RulesModule

    public abstract class FromAnnotationsRuleModule
    extends AbstractRulesModule
    RulesModule implementation that allows loading rules from annotated classes.
    Since:
    3.0
    • Constructor Detail

      • FromAnnotationsRuleModule

        public FromAnnotationsRuleModule()
    • Method Detail

      • configureRules

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

        protected final void useDefaultAnnotationHandlerFactory()
        Allows users to switch back to the default AnnotationHandlerFactory 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.