Below are brief descriptions of all of the standard rules.
Creational
-
ObjectCreateRule
: Creates an object of the specified class using its default constructor and pushes it onto the stack; it is popped when the element completes. The class to instantiate can be given through aclass
object or the fully-qualified class name. -
FactoryCreateRule
: Creates an object using a specified factory class and pushes it onto the stack. This can be useful for classes that do not provide a default constructor. The factory class must implement theorg.apache.commons.digester.ObjectCreationFactory
interface.
Property Setters
-
SetPropertiesRule
: Sets one or several named properties in the top-level bean using the values of named XML element attributes. Attribute names and property names are passed to this rule inString[]
arrays. (Typically used to handle XML constructs like<article page="10">
.) -
BeanPropertySetterRule
: Sets a named property on the top-level bean to the character data enclosed by the current XML element. (Example:<page>10</page>
.) -
SetPropertyRule
: Sets a property on the top-level bean. Both the property name, as well as the value to which this property will be set, are given as attributes to the current XML element. (Example:<article key="page" value="10" />
.)
Parent/Child Management
-
SetNextRule
: Pops the object on top of the stack and passes it to a named method on the object immediately below. Typically used to insert a completed bean into its parent. -
SetTopRule
: Passes the second-to-top object on the stack to the top-level object. This is useful if the child object exposes asetParent
method, rather than the other way around. -
SetRootRule
: Calls a method on the object at the bottom of the stack, passing the object on top of the stack as argument.
Arbitrary Method Calls
-
CallMethodRule
: Calls an arbitrary named method on the top-level bean. The method may take an arbitrary set of parameters. The values of the parameters are given by subsequent applications of theCallParamRule
. -
CallParamRule
: Represents the value of a method parameter. The value of the parameter is either taken from a named XML element attribute, or from the raw character data enclosed by the current element. This rule requires that its position on the parameter list is specified by an integer index.