beanface.el.tags
Class DefineTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by beanface.el.tags.DefineTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag

public class DefineTag
extends javax.servlet.jsp.tagext.SimpleTagSupport

A JSP Tag for mapping a variable to a constant value expression.


Constructor Summary
DefineTag()
           
 
Method Summary
 void doTag()
           
 java.lang.Class getExpectedType()
          The explicit "expected type" to be used when constructing the literal value expression.
 java.lang.String getExpectedTypeName()
          Gets the name of the explicit "expected type" from getExpectedType(), or null if it is not set.
 java.lang.Object getValue()
          Get the value or expression to be mapped.
 java.lang.String getVar()
          Get the name of the variable to be mapped.
 void setExpectedType(java.lang.Class expectedType)
          Sets the "expected type" to be used when constructing the literal value expression via ExpressionFactory.createValueExpression(java.lang.Object, java.lang.Class)
 void setExpectedTypeName(java.lang.String expressionClassRef)
          Sets the name of the "expected type" via setExpectedType(java.lang.Class).
 void setValue(java.lang.Object value)
          Sets the value to be mapped to the variable.
 void setVar(java.lang.String var)
          Set the name of the variable to be mapped.
 
Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefineTag

public DefineTag()
Method Detail

getVar

public java.lang.String getVar()
Get the name of the variable to be mapped.

Returns:
the variable name.

setVar

public void setVar(java.lang.String var)
Set the name of the variable to be mapped.

Parameters:
var - is the variable name (cannot be null).
Throws:
java.lang.NullPointerException - if var is null.

getValue

public java.lang.Object getValue()
Get the value or expression to be mapped.

Returns:
the value.

setValue

public void setValue(java.lang.Object value)
Sets the value to be mapped to the variable.

Parameters:
value - the value to map. Can be null (to clear the variable mapping), an instance of ValueExpression which will be evaluated at the time of mapping, or a plain object.

getExpectedType

public java.lang.Class getExpectedType()
The explicit "expected type" to be used when constructing the literal value expression.

Returns:
the expected type.

setExpectedType

public void setExpectedType(java.lang.Class expectedType)
Sets the "expected type" to be used when constructing the literal value expression via ExpressionFactory.createValueExpression(java.lang.Object, java.lang.Class)

Parameters:
expectedType - the expected type. May be null, in which case the expected type used will be the class of the value when the mapping is done.

getExpectedTypeName

public java.lang.String getExpectedTypeName()
Gets the name of the explicit "expected type" from getExpectedType(), or null if it is not set.

Returns:
the expected type name.

setExpectedTypeName

public void setExpectedTypeName(java.lang.String expressionClassRef)
                         throws java.lang.ClassNotFoundException
Sets the name of the "expected type" via setExpectedType(java.lang.Class).

Parameters:
expressionClassRef - the name of the expected type, or null to use the default.
Throws:
java.lang.ClassNotFoundException - when expressionClassRef is not null and can't be loaded with Class.forName(java.lang.String).

doTag

public void doTag()
           throws javax.servlet.jsp.JspException,
                  java.io.IOException
Specified by:
doTag in interface javax.servlet.jsp.tagext.SimpleTag
Overrides:
doTag in class javax.servlet.jsp.tagext.SimpleTagSupport
Throws:
javax.servlet.jsp.JspException
java.io.IOException