Class PluginRules

  • All Implemented Interfaces:
    Rules

    public class PluginRules
    extends java.lang.Object
    implements Rules
    A custom digester Rules manager which must be used as the Rules object when using the plugins module functionality.

    During parsing, a linked list of PluginCreateRule instances develop, and this list also acts like a stack. The original instance that was set before the Digester started parsing is always at the tail of the list, and the Digester always holds a reference to the instance at the head of the list in the rules member. Initially, this list/stack holds just one instance, ie head and tail are the same object.

    When the start of an xml element causes a PluginCreateRule to fire, a new PluginRules instance is created and inserted at the head of the list (ie pushed onto the stack of Rules objects). Digester.getRules() therefore returns this new Rules object, and any custom rules associated with that plugin are added to that instance.

    When the end of the xml element is encountered (and therefore the PluginCreateRule end method fires), the stack of Rules objects is popped, so that Digester.getRules returns the previous Rules object.

    Since:
    1.6
    • Field Detail

      • digester

        protected Digester digester
        The Digester instance with which this Rules instance is associated.
    • Constructor Detail

      • PluginRules

        public PluginRules()
        Constructor for top-level Rules objects. Exactly one of these must be created and installed into the Digester instance as the Rules object before parsing starts.
      • PluginRules

        public PluginRules​(Rules decoratedRules)
        Constructor for top-level Rules object which handles rule-matching using the specified implementation.