freemarker.template
Class SimpleScalar

java.lang.Object
  |
  +--freemarker.template.SimpleScalar
All Implemented Interfaces:
java.io.Serializable, TemplateModel, TemplateScalarModel

public class SimpleScalar
extends java.lang.Object
implements TemplateScalarModel, java.io.Serializable

A simple implementation of the TemplateScalarModel interface, using a String.

All the public methods in this implementation are synchronized.

See Also:
Serialized Form

Field Summary
protected  boolean booleanValue
           
protected  boolean useBoolean
           
protected  java.lang.String value
           
 
Constructor Summary
SimpleScalar()
          Constructs an empty SimpleScalar.
SimpleScalar(boolean value)
          Constructs a SimpleScalar containing a boolean value.
SimpleScalar(java.lang.String value)
          Constructs a SimpleScalar containing a string value.
 
Method Summary
 java.lang.String getAsString()
          Returns the scalar's value as a String.
 boolean isEmpty()
           
 void setValue(boolean value)
          Sets the boolean value of this SimpleScalar.
 void setValue(java.lang.String value)
          Sets the string value of this SimpleScalar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected java.lang.String value

booleanValue

protected boolean booleanValue

useBoolean

protected boolean useBoolean
Constructor Detail

SimpleScalar

public SimpleScalar()
Constructs an empty SimpleScalar.

SimpleScalar

public SimpleScalar(java.lang.String value)
Constructs a SimpleScalar containing a string value.
Parameters:
value - the string value.

SimpleScalar

public SimpleScalar(boolean value)
Constructs a SimpleScalar containing a boolean value.
Parameters:
value - the boolean value.
Method Detail

isEmpty

public boolean isEmpty()
                throws TemplateModelException
Specified by:
isEmpty in interface TemplateModel
Following copied from interface: freemarker.template.TemplateModel
Returns:
true if this object is empty.

getAsString

public java.lang.String getAsString()
                             throws TemplateModelException
Description copied from interface: TemplateScalarModel
Returns the scalar's value as a String.
Specified by:
getAsString in interface TemplateScalarModel
Following copied from interface: freemarker.template.TemplateScalarModel
Returns:
the String value of this scalar.

setValue

public void setValue(java.lang.String value)
Sets the string value of this SimpleScalar.
Parameters:
value - the string value.

setValue

public void setValue(boolean value)
Sets the boolean value of this SimpleScalar.
Parameters:
value - the boolean value.