org.apache.commons.digester
Class CallParamRule
public class CallParamRule
Rule implementation that saves a parameter for use by a surrounding
CallMethodRule
.
This parameter may be:
- from an attribute of the current element
See
CallParamRule(int paramIndex, String attributeName)
- from current the element body
See
CallParamRule(int paramIndex)
- from the top object on the stack.
See
CallParamRule(int paramIndex, boolean fromStack)
- the current path being processed (separate
Rule
).
See PathCallParamRule
protected String | attributeName - The attribute from which to save the parameter value
|
protected ArrayStack | bodyTextStack - Stack is used to allow nested body text to be processed.
|
protected boolean | fromStack - Is the parameter to be set from the stack?
|
protected int | paramIndex - The zero-relative index of the parameter we are saving.
|
protected int | stackIndex - The position of the object from the top of the stack
|
CallParamRule(int paramIndex) - Construct a "call parameter" rule that will save the body text of this
element as the parameter value.
|
CallParamRule(int paramIndex, String attributeName) - Construct a "call parameter" rule that will save the value of the
specified attribute as the parameter value.
|
CallParamRule(int paramIndex, boolean fromStack) - Construct a "call parameter" rule.
|
CallParamRule(int paramIndex, int stackIndex) - Constructs a "call parameter" rule which sets a parameter from the stack.
|
CallParamRule(Digester digester, int paramIndex) - The digester instance is now set in the
Digester.addRule(String,Rule) method.
|
CallParamRule(Digester digester, int paramIndex, String attributeName) - The digester instance is now set in the
Digester.addRule(String,Rule) method.
|
void | begin(Attributes attributes) - Process the start of this element.
|
void | body(String bodyText) - Process the body text of this element.
|
void | end(String namespace, String name) - Process any body texts now.
|
String | toString() - Render a printable version of this Rule.
|
begin , begin , body , body , end , end , finish , getDigester , getNamespaceURI , setDigester , setNamespaceURI |
attributeName
protected String attributeName
The attribute from which to save the parameter value
bodyTextStack
protected ArrayStack bodyTextStack
Stack is used to allow nested body text to be processed.
Lazy creation.
fromStack
protected boolean fromStack
Is the parameter to be set from the stack?
paramIndex
protected int paramIndex
The zero-relative index of the parameter we are saving.
stackIndex
protected int stackIndex
The position of the object from the top of the stack
CallParamRule
public CallParamRule(int paramIndex)
Construct a "call parameter" rule that will save the body text of this
element as the parameter value.
Note that if the element is empty the an
empty string is
passed to the target method, not null. And if automatic type conversion
is being applied (ie if the target function takes something other than
a string as a parameter) then the conversion will fail if the converter
class does not accept an empty string as valid input.
paramIndex
- The zero-relative parameter number
CallParamRule
public CallParamRule(int paramIndex,
String attributeName)
Construct a "call parameter" rule that will save the value of the
specified attribute as the parameter value.
paramIndex
- The zero-relative parameter numberattributeName
- The name of the attribute to save
CallParamRule
public CallParamRule(int paramIndex,
boolean fromStack)
Construct a "call parameter" rule.
paramIndex
- The zero-relative parameter numberfromStack
- should this parameter be taken from the top of the stack?
CallParamRule
public CallParamRule(int paramIndex,
int stackIndex)
Constructs a "call parameter" rule which sets a parameter from the stack.
If the stack contains too few objects, then the parameter will be set to null.
paramIndex
- The zero-relative parameter numberstackIndex
- the index of the object which will be passed as a parameter.
The zeroth object is the top of the stack, 1 is the next object down and so on.
CallParamRule
public CallParamRule(Digester digester,
int paramIndex)
The digester instance is now set in the Digester.addRule(String,Rule)
method.
Use CallParamRule(int paramIndex)
instead.
Construct a "call parameter" rule that will save the body text of this
element as the parameter value.
Note that if the element is empty the an
empty string is
passed to the target method, not null. And if automatic type conversion
is being applied (ie if the target function takes something other than
a string as a parameter) then the conversion will fail if the converter
class does not accept an empty string as valid input.
digester
- The associated DigesterparamIndex
- The zero-relative parameter number
CallParamRule
public CallParamRule(Digester digester,
int paramIndex,
String attributeName)
The digester instance is now set in the Digester.addRule(String,Rule)
method.
Use CallParamRule(int paramIndex, String attributeName)
instead.
Construct a "call parameter" rule that will save the value of the
specified attribute as the parameter value.
digester
- The associated DigesterparamIndex
- The zero-relative parameter numberattributeName
- The name of the attribute to save
begin
public void begin(Attributes attributes)
throws Exception
Process the start of this element.
- begin in interface Rule
attributes
- The attribute list for this element
body
public void body(String bodyText)
throws Exception
Process the body text of this element.
- body in interface Rule
bodyText
- The body text of this element
end
public void end(String namespace,
String name)
Process any body texts now.
- end in interface Rule
toString
public String toString()
Render a printable version of this Rule.
Copyright 2001-2005 The Apache Software Foundation.