Class SetNextRule
- java.lang.Object
-
- org.apache.commons.digester3.Rule
-
- org.apache.commons.digester3.AbstractMethodRule
-
- org.apache.commons.digester3.SetNextRule
-
public class SetNextRule extends AbstractMethodRule
Rule implementation that calls a method on the (top-1) (parent) object, passing the top object (child) as an argument. It is commonly used to establish parent-child relationships.
This rule now supports more flexible method matching by default. It is possible that this may break (some) code written against release 1.1.1 or earlier. See
AbstractMethodRule.isExactMatch()
for more details.Note that while CallMethodRule uses commons-beanutils' data-conversion functionality (ConvertUtils class) to convert parameter values into the appropriate type for the parameter to the called method, this rule does not. Needing to use ConvertUtils functionality when building parent-child relationships is expected to be very rare; however if you do need this then instead of using this rule, create a CallMethodRule specifying targetOffset of 1 in the constructor.
-
-
Field Summary
-
Fields inherited from class org.apache.commons.digester3.AbstractMethodRule
fireOnBegin, methodName, paramType, paramTypeName, useExactMatch
-
-
Constructor Summary
Constructors Constructor Description SetNextRule(java.lang.String methodName)
Construct a "set next" rule with the specified method name.SetNextRule(java.lang.String methodName, java.lang.Class<?> paramType)
Construct a "set next" rule with the specified method name.SetNextRule(java.lang.String methodName, java.lang.String paramType)
Construct a "set next" rule with the specified method name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object
getChild()
Returns the argument object of method has to be invoked.protected java.lang.Object
getParent()
Returns the target object of method has to be invoked.-
Methods inherited from class org.apache.commons.digester3.AbstractMethodRule
begin, end, isExactMatch, isFireOnBegin, setExactMatch, setFireOnBegin, toString
-
Methods inherited from class org.apache.commons.digester3.Rule
body, finish, getDigester, getNamespaceURI, setDigester, setNamespaceURI
-
-
-
-
Constructor Detail
-
SetNextRule
public SetNextRule(java.lang.String methodName)
Construct a "set next" rule with the specified method name. The method's argument type is assumed to be the class of the child object.- Parameters:
methodName
- Method name of the parent method to call
-
SetNextRule
public SetNextRule(java.lang.String methodName, java.lang.String paramType)
Construct a "set next" rule with the specified method name.- Parameters:
methodName
- Method name of the parent method to callparamType
- Java class name of the parent method's argument (if you wish to use a primitive type, specify the corresonding Java wrapper class instead, such asjava.lang.Boolean
for aboolean
parameter)
-
SetNextRule
public SetNextRule(java.lang.String methodName, java.lang.Class<?> paramType)
Construct a "set next" rule with the specified method name.- Parameters:
methodName
- Method name of the parent method to callparamType
- Java class of the parent method's argument (if you wish to use a primitive type, specify the corresonding Java wrapper class instead, such asjava.lang.Boolean
for aboolean
parameter)
-
-
Method Detail
-
getChild
protected java.lang.Object getChild()
Returns the argument object of method has to be invoked.- Specified by:
getChild
in classAbstractMethodRule
- Returns:
- the argument object of method has to be invoked.
-
getParent
protected java.lang.Object getParent()
Returns the target object of method has to be invoked.- Specified by:
getParent
in classAbstractMethodRule
- Returns:
- the target object of method has to be invoked.
-
-