org.apache.commons.jelly.tags.core
Class SetTag

java.lang.Object
  extended by org.apache.commons.jelly.TagSupport
      extended by org.apache.commons.jelly.tags.core.SetTag
All Implemented Interfaces:
Tag

public class SetTag
extends TagSupport

A tag which sets a variable from the result of an expression

Version:
$Revision: 1807798 $
Author:
James Strachan

Field Summary
private  Expression defaultValue
          The default value
private  boolean encode
          Should we XML encode the body of this tag as text?
private static org.apache.commons.logging.Log log
          The Log to which logging calls will be made.
private  java.lang.String property
          The name of the property to set on the target object.
private  java.lang.String scope
          The variable scope to export
private  java.lang.Object target
          The target object on which to set a property.
private  Expression value
          The expression to evaluate.
private  java.lang.String var
          The variable name to export.
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
SetTag()
           
 
Method Summary
 void doTag(XMLOutput output)
          Evaluates this tag after all the tags properties have been initialized.
protected  boolean isEmpty(java.lang.Object value)
           
 boolean isEncode()
          Returns whether the body of this tag will be XML encoded or not.
 void setDefaultValue(Expression defaultValue)
          Sets the default value to be used if the value exprsesion results in a null value or blank String
 void setEncode(boolean encode)
          Sets whether the body of the tag should be XML encoded as text (so that < and > are encoded as &lt; and &gt;) or leave the text as XML which is the default.
 void setProperty(java.lang.String property)
          Sets the name of the property to set on the target object.
protected  void setPropertyValue(java.lang.Object target, java.lang.String property, java.lang.Object value)
           
 void setScope(java.lang.String scope)
          Sets the variable scope for this variable.
 void setTarget(java.lang.Object target)
          Sets the target object on which to set a property.
 void setValue(Expression value)
          Sets the expression to evaluate.
 void setVar(java.lang.String var)
          Sets the variable name to define for this expression
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log
The Log to which logging calls will be made.


var

private java.lang.String var
The variable name to export.


scope

private java.lang.String scope
The variable scope to export


value

private Expression value
The expression to evaluate.


defaultValue

private Expression defaultValue
The default value


target

private java.lang.Object target
The target object on which to set a property.


property

private java.lang.String property
The name of the property to set on the target object.


encode

private boolean encode
Should we XML encode the body of this tag as text?

Constructor Detail

SetTag

public SetTag()
Method Detail

doTag

public void doTag(XMLOutput output)
           throws JellyTagException
Description copied from interface: Tag
Evaluates this tag after all the tags properties have been initialized.

Throws:
JellyTagException

setVar

public void setVar(java.lang.String var)
Sets the variable name to define for this expression


setScope

public void setScope(java.lang.String scope)
Sets the variable scope for this variable. For example setting this value to 'parent' will set this value in the parent scope. When Jelly is run from inside a Servlet environment then other scopes will be available such as 'request', 'session' or 'application'. Other applications may implement their own custom scopes.


setValue

public void setValue(Expression value)
Sets the expression to evaluate.


setDefaultValue

public void setDefaultValue(Expression defaultValue)
Sets the default value to be used if the value exprsesion results in a null value or blank String


setTarget

public void setTarget(java.lang.Object target)
Sets the target object on which to set a property.


setProperty

public void setProperty(java.lang.String property)
Sets the name of the property to set on the target object.


isEncode

public boolean isEncode()
Returns whether the body of this tag will be XML encoded or not.


setEncode

public void setEncode(boolean encode)
Sets whether the body of the tag should be XML encoded as text (so that < and > are encoded as &lt; and &gt;) or leave the text as XML which is the default. This is only used if this tag is specified with no value so that the text body of this tag is used as the body.


setPropertyValue

protected void setPropertyValue(java.lang.Object target,
                                java.lang.String property,
                                java.lang.Object value)

isEmpty

protected boolean isEmpty(java.lang.Object value)
Parameters:
value -
Returns:
true if the given value is null or an empty String