|
BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.jsp.tagext.TagSupport javax.servlet.jsp.tagext.BodyTagSupport com.bea.wlw.netui.tags.AbstractBaseTag com.bea.wlw.netui.tags.databinding.invoke.AbstractCallMethod
public abstract class AbstractCallMethod
An abstract base class for tags that are capable of reflectively invoking methods. Specializations of this tag provide method implementations that locate the object on which to invoke the method and that handle any return value from the invoked method.
The CallMethod
tag can have child tags of type
MethodParameter
; these tags must be in the same
order as the parameter list in the method signature of the
method that will be invoked. To invoke an overloaded method, the
MethodParamter#setType()
property must be set to the String
name of the type to pass to the method. If the type attribute values
on nested MethodParameter
tags do not match any method signature,
an error will be reported in the page.
Attribute Descriptions | |||
---|---|---|---|
Attribute | Required | Runtime Expression Evaluation | Data Bindable |
method | No | No | No |
The method to invoke on an object. | |||
failOnError | No | No | No |
A boolean that if true will cause the tag to report any method invocation errors in-line in the rendered page. | |||
resultId | No | No | No |
The PageContext attribute name where the result, if non-null, is stored. |
Nested Class Summary | |
---|---|
protected static class |
AbstractCallMethod.ParamNode
An internal struct that represents a parameter that will be passed to a reflective method invocation call. |
Field Summary |
---|
Fields inherited from class com.bea.wlw.netui.tags.AbstractBaseTag |
---|
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, JAVASCRIPT_STATUS, NETUI_UNIQUE_CNT |
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
---|
bodyContent |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
id, pageContext |
Fields inherited from interface com.bea.wlw.netui.tags.html.HtmlConstants |
---|
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH |
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag |
---|
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
---|
EVAL_BODY_AGAIN |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Constructor Summary | |
---|---|
AbstractCallMethod()
|
Method Summary | |
---|---|
void |
addParameter(String type,
Object parameter)
Add a paramter that will be passed as an argument to the method that will be invoked. |
int |
doEndTag()
Reflectively invokes the method specified by the method attribute,
getMethod() . |
int |
doStartTag()
Causes the body of this tag to be rendered; only MethodParameter
tags are allowed to be contained inside of this tag. |
protected Method |
findMethod(Object target,
String methodName,
boolean verifyTypes)
The default findMethod implementation is an uncached search of all of the methods available on the Class of the target |
boolean |
getFailOnError()
Get whether or not errors invoking a method are reported in-line when the tag renders. |
String |
getMethod()
Gets the name of the method to invoke on the target object. |
protected abstract String |
getObjectName()
Get the name of the object that is the target of the invocation. |
protected List |
getParameterNodes()
Internal, read-only property used by subclasses to get the list of parameters to be used when reflectively invoking a method. |
String |
getResultId()
Get the identifier at which the result of invoking the method can be found. |
protected void |
handleReturnValue(Object result)
A method that allows concrete classes to handle the result of the reflective invocation in an implementation specific way. |
protected void |
localRelease()
Reset all of the fields of this tag. |
protected abstract Object |
resolveObject()
Resolve the object on which the method should be invoked. |
void |
setFailOnError(boolean failOnError)
Sets whether or not to report exceptions to the page when errors occur invoking a method on an object. |
void |
setMethod(String method)
Sets the name of a method to invoke on the target object. |
void |
setResultId(String resultId)
Sets the identifier at which the result of invoking the method will stored. |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
---|
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.jsp.tagext.Tag |
---|
getParent, setParent |
Constructor Detail |
---|
public AbstractCallMethod()
Method Detail |
---|
protected abstract Object resolveObject() throws ObjectNotFoundException
Resolve the object on which the method should be invoked. If there are
errors resolving this object, this method will throw an ObjectNotFoundException
.
If the object is not found but no exception occurred, this method should return null.
ObjectNotFoundException
- if an exception occurred attempting to resolve an objectprotected abstract String getObjectName()
protected void handleReturnValue(Object result)
A method that allows concrete classes to handle the result of the reflective invocation in an implementation specific way.
The default beahavior is to set the return value resulting from invoking the method
in the PageContext
attribute map of the current JSP page.
The result is set as an attribute if the result
is not null and the
getResultId()
String is not null. If the value returned
from calling a method is null and the getResultId()
is non-null,
the javax.servlet.jsp.Pagecontext#removeAttribute(java.lang.String)
is called to remove the attribute from the attribute map.
result
- the object that was returned by calling the method on the objectprotected List getParameterNodes()
public void setResultId(String resultId)
resultId
- a String that names an attribute in the PageContext's
attribute map where any resulting object will be stored.public String getResultId()
public void setFailOnError(boolean failOnError)
failOnError
- a boolean that defines whether or not exceptions
should be thrown when invocation fails.public boolean getFailOnError()
public void setMethod(String method)
method
- the name of the method to invokepublic String getMethod()
public void addParameter(String type, Object parameter)
MethodParameter
tags to register
their parameters. This object is passed in the position that it
appeared in the set of child MethodParameter
tags.
type
- a String of the type or class name of this parameterparameter
- an object that should be passed as an argument to the invoked methodMethodParameter
public int doStartTag() throws javax.servlet.jsp.JspException
MethodParameter
tags are allowed to be contained inside of this tag. The body content is
never rendered.
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
MethodParameter
public int doEndTag() throws javax.servlet.jsp.JspException
method
attribute,
getMethod()
. The arguments passed to the method are taken from any nested
MethodParameter
tags. When the parameters which are added by the
MethodParameter
tags are String
types, an attempt is made
to convert each of these parameters into the type expected by the method. This
conversion is done using the TypeUtils.convertToObject(java.lang.String, java.lang.Class)
method. If a String can not be converted do the type expected by the method,
an exception is thrown and the error is reported in the tag. Any return value
that results from invoking the given method is passed to the subclass implementation
of the method handleReturnValue(java.lang.Object)
.
doEndTag
in interface javax.servlet.jsp.tagext.Tag
doEndTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- if there are errors. All exceptions that may be thrown
in the process of reflectively invoking the method and performing type
conversion are reported as @see javax.servlet.jsp.JspException.getMethod()
,
handleReturnValue(java.lang.Object)
,
MethodParameter
,
ObjectNotFoundException
,
TypeUtils.convertToObject(java.lang.String, java.lang.Class)
,
String
protected void localRelease()
localRelease
in class AbstractBaseTag
protected Method findMethod(Object target, String methodName, boolean verifyTypes)
target
target
- the object from which to find the methodmethodName
- the name of the method to findverifyTypes
- a boolean that if true will match the type names in addition to the String method name
verifyTypes
is true.
null
otherwise.
|
BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |