|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.digester.Rule
org.opencms.configuration.CmsSetNextRule
public class CmsSetNextRule
Rule implementation that invokes a method on the (top-1) (parent) object,
passing as implicit first argument of type
and as a further argument the top stack instance. CmsObject
If no subsequent CallParamRule
are matched for CmsObject
which is the case in the OpenCms usage the first argument CmsObject
will be null at method invocation time.
This is an alternative for
if a parent to child-property configuration has been done but the setter for that
property requires additional arguments that are only available at real runtime
of the application.SetNextRule
The top stack element (child) that has to be set is matched against the constructor
given
: It is used as argument on the position
where the Class
[]Class[]
has an instance of the same type as it's own Class
.
CallMethodRule
,
SetNextRule
Field Summary | |
---|---|
protected java.lang.String |
m_bodyText
The body text collected from this element. |
protected java.lang.String |
m_methodName
The method name to call on the parent object. |
protected int |
m_paramCount
The number of parameters to collect from MethodParam rules. |
protected java.lang.Class[] |
m_paramTypes
The parameter types of the parameters to be collected. |
protected boolean |
m_useExactMatch
Should MethodUtils.invokeExactMethod be used for reflection. |
Fields inherited from class org.apache.commons.digester.Rule |
---|
digester, namespaceURI |
Constructor Summary | |
---|---|
CmsSetNextRule(java.lang.String methodName,
java.lang.Class clazz)
Construct a "call method" rule with the specified method name. |
|
CmsSetNextRule(java.lang.String methodName,
java.lang.Class[] clazzes)
Construct a "call method" rule with the specified method name and additional parameters. |
Method Summary | |
---|---|
void |
begin(java.lang.String namespace,
java.lang.String name,
org.xml.sax.Attributes attributes)
Process the start of this element. |
void |
body(java.lang.String namespace,
java.lang.String name,
java.lang.String bodyText)
Process the body text of this element. |
void |
end(java.lang.String namespace,
java.lang.String name)
Process the end of this element. |
void |
finish(java.lang.String namespace,
java.lang.String name)
Clean up after parsing is complete. |
boolean |
getUseExactMatch()
Returns true if MethodUtils.invokeExactMethod
shall be used for the reflection. |
protected void |
processMethodCallResult(java.lang.Object result)
Subclasses may override this method to perform additional processing of the invoked method's result. |
void |
setDigester(org.apache.commons.digester.Digester aDigester)
Set the associated digester. |
void |
setUseExactMatch(boolean useExactMatch)
Set the value to use for MethodUtils.invokeExactMethod
to use. |
java.lang.String |
toString()
Returns a printable version of this Rule. |
Methods inherited from class org.apache.commons.digester.Rule |
---|
begin, body, end, finish, getDigester, getNamespaceURI, setNamespaceURI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String m_bodyText
protected java.lang.String m_methodName
protected int m_paramCount
MethodParam
rules.
If this value is zero, a single parameter will be collected from the
body of this element.
protected java.lang.Class[] m_paramTypes
protected boolean m_useExactMatch
MethodUtils.invokeExactMethod
be used for reflection.
Constructor Detail |
---|
public CmsSetNextRule(java.lang.String methodName, java.lang.Class clazz)
The 1st argument of the method will be of type
.
It's value will remain null (except subsequent
CmsObject
would put a value
which currently is impossible at initialization time within OpenCms).CallParamRule
The 2nd argument will be the top-stack element at digestion time.
That instance has to be of the same type as the clazz
argument to succeed.
methodName
- Method name of the parent method to callclazz
- The class of the top-stack element (child) that will be present at digestion-timepublic CmsSetNextRule(java.lang.String methodName, java.lang.Class[] clazzes)
The 1st argument of the method will be of type
.
It's value will remain null (except subsequent
CmsObject
would put a value
which currently is impossible at initialization time within OpenCms).CallParamRule
The further arguments will be filled by the subsequent
matches. If the first CallParamRule
Class
in the given array matches the top stack element
(child) that value will be used. If at digestion time no parameters are found for the given
types their values for invocation of the method remain null.
methodName
- Method name of the parent method to callclazzes
- an array with all parameter types for the method to invoke at digestion timeMethod Detail |
---|
public void begin(java.lang.String namespace, java.lang.String name, org.xml.sax.Attributes attributes) throws java.lang.Exception
begin
in class org.apache.commons.digester.Rule
attributes
- The attribute list for this elementnamespace
- the namespace URI of the matching element, or an empty string if the parser is not namespace
aware or the element has no namespacename
- the local name if the parser is namespace aware, or just the element name otherwise
java.lang.Exception
- if something goes wrongpublic void body(java.lang.String namespace, java.lang.String name, java.lang.String bodyText) throws java.lang.Exception
body
in class org.apache.commons.digester.Rule
bodyText
- The body text of this elementnamespace
- the namespace URI of the matching element, or an empty string if the parser is not namespace
aware or the element has no namespacename
- the local name if the parser is namespace aware, or just the element name otherwise
java.lang.Exception
- if something goes wrongpublic void end(java.lang.String namespace, java.lang.String name) throws java.lang.Exception
end
in class org.apache.commons.digester.Rule
namespace
- the namespace URI of the matching element, or an empty string if the parser is not namespace
aware or the element has no namespacename
- the local name if the parser is namespace aware, or just the element name otherwise
java.lang.Exception
- if something goes wrongpublic void finish(java.lang.String namespace, java.lang.String name) throws java.lang.Exception
namespace
- the namespace URI of the matching element, or an empty string if the parser is not namespace
aware or the element has no namespacename
- the local name if the parser is namespace aware, or just the element name otherwise
java.lang.Exception
- if something goes wrongpublic boolean getUseExactMatch()
MethodUtils.invokeExactMethod
shall be used for the reflection.
MethodUtils.invokeExactMethod
shall be used for the reflection.public void setDigester(org.apache.commons.digester.Digester aDigester)
The digester gets assigned to use the OpenCms conform logging If needed, this class loads the parameter classes from their names.
setDigester
in class org.apache.commons.digester.Rule
aDigester
- the associated digester to setpublic void setUseExactMatch(boolean useExactMatch)
MethodUtils.invokeExactMethod
to use.
useExactMatch
- the value to use for MethodUtils.invokeExactMethod
to usepublic java.lang.String toString()
toString
in class java.lang.Object
protected void processMethodCallResult(java.lang.Object result)
result
- the Object returned by the method invoked, possibly null
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |