org.apache.commons.digester3
Class SetTopRule

java.lang.Object
  extended by org.apache.commons.digester3.Rule
      extended by org.apache.commons.digester3.AbstractMethodRule
          extended by org.apache.commons.digester3.SetTopRule

public class SetTopRule
extends AbstractMethodRule

Rule implementation that calls a "set parent" method on the top (child) object, passing the (top-1) (parent) object as an argument.

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.


Field Summary
 
Fields inherited from class org.apache.commons.digester3.AbstractMethodRule
fireOnBegin, methodName, paramType, paramTypeName, useExactMatch
 
Constructor Summary
SetTopRule(String methodName)
          Construct a "set top" rule with the specified method name.
SetTopRule(String methodName, Class<?> paramType)
          Construct a "set top" rule with the specified method name.
SetTopRule(String methodName, String paramType)
          Construct a "set top" rule with the specified method name.
 
Method Summary
protected  Object getChild()
          Returns the argument object of method has to be invoked.
protected  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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SetTopRule

public SetTopRule(String methodName)
Construct a "set top" 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

SetTopRule

public SetTopRule(String methodName,
                  String paramType)
Construct a "set top" rule with the specified method name.

Parameters:
methodName - Method name of the parent method to call
paramType - 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 as java.lang.Boolean for a boolean parameter)

SetTopRule

public SetTopRule(String methodName,
                  Class<?> paramType)
Construct a "set top" rule with the specified method name.

Parameters:
methodName - Method name of the parent method to call
paramType - Java class of the parent method's argument (if you wish to use a primitive type, specify the corresonding Java wrapper class instead, such as java.lang.Boolean for a boolean parameter)
Method Detail

getChild

protected Object getChild()
Returns the argument object of method has to be invoked.

Specified by:
getChild in class AbstractMethodRule
Returns:
the argument object of method has to be invoked.

getParent

protected Object getParent()
Returns the target object of method has to be invoked.

Specified by:
getParent in class AbstractMethodRule
Returns:
the target object of method has to be invoked.


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.