Class WithMemoryRulesBinder

  • All Implemented Interfaces:
    RulesBinder

    class WithMemoryRulesBinder
    extends java.lang.Object
    implements RulesBinder
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      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.
      LinkedRuleBuilder forPattern​(java.lang.String pattern)
      Allows to associate the given pattern to one or more Digester rules.
      java.lang.ClassLoader getContextClassLoader()
      Returns the context ClassLoader.
      java.util.Set<java.lang.String> getIncludedFiles()  
      PatternStack getPatternStack()  
      void install​(RulesModule rulesModule)
      Allows sub-modules inclusion while binding rules.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • patternStack

        private final PatternStack patternStack
        A stack used to maintain the current pattern. The Rules XML document type allows nesting of patterns. If an element defines a matching pattern, the resulting pattern is a concatenation of that pattern with all the ancestor elements' patterns. Hence the need for a stack.
      • includedFiles

        private final java.util.Set<java.lang.String> includedFiles
        Used to detect circular includes
      • wrappedRulesBinder

        private final RulesBinder wrappedRulesBinder
    • Constructor Detail

      • WithMemoryRulesBinder

        public WithMemoryRulesBinder​(RulesBinder wrappedRulesBinder)
    • Method Detail

      • getContextClassLoader

        public java.lang.ClassLoader getContextClassLoader()
        Returns the context ClassLoader.
        Specified by:
        getContextClassLoader in interface RulesBinder
        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. Uses String.format(String, Object[]) to insert the arguments into the message.
        Specified by:
        addError in interface RulesBinder
        Parameters:
        messagePattern - The message string pattern
        arguments - 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:
        addError in interface RulesBinder
        Parameters:
        t - The exception has to be recorded.
      • install

        public void install​(RulesModule rulesModule)
        Allows sub-modules inclusion while binding rules.
        Specified by:
        install in interface RulesBinder
        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:
        forPattern in interface RulesBinder
        Parameters:
        pattern - The pattern that this rule should match
        Returns:
        The Digester rules builder
      • getPatternStack

        public PatternStack getPatternStack()
        Returns:
        the pattern stack
      • getIncludedFiles

        public java.util.Set<java.lang.String> getIncludedFiles()
        Returns:
        the set of included files