freemarker.template
Class SimpleScalar

java.lang.Object
  extended by freemarker.template.SimpleScalar
All Implemented Interfaces:
TemplateModel, TemplateScalarModel, java.io.Serializable

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

A simple implementation of the TemplateScalarModel interface, using a String. As of version 2.0 this object is immutable.

This class is thread-safe.

Version:
$Id: SimpleScalar.java,v 1.38 2004/09/10 20:50:45 ddekany Exp $
See Also:
SimpleSequence, SimpleHash, Serialized Form

Field Summary
 
Fields inherited from interface freemarker.template.TemplateScalarModel
EMPTY_STRING
 
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
 
Constructor Summary
SimpleScalar(java.lang.String value)
          Constructs a SimpleScalar containing a string value.
 
Method Summary
 java.lang.String getAsString()
          Returns the string representation of this model.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleScalar

public SimpleScalar(java.lang.String value)
Constructs a SimpleScalar containing a string value.

Parameters:
value - the string value.
Method Detail

getAsString

public java.lang.String getAsString()
Description copied from interface: TemplateScalarModel
Returns the string representation of this model. In general, avoid returning null. In compatibility mode the engine will convert null into empty string, however in normal mode it will throw an exception if you return null from this method.

Specified by:
getAsString in interface TemplateScalarModel

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object