freemarker.template

Class SimpleScalar

Implemented Interfaces:
Serializable, TemplateModel, TemplateScalarModel

public final class SimpleScalar
extends java.lang.Object
implements TemplateScalarModel, 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

Fields inherited from interface freemarker.template.TemplateModel

NOTHING

Fields inherited from interface freemarker.template.TemplateScalarModel

EMPTY_STRING

Constructor Summary

SimpleScalar(String value)
Constructs a SimpleScalar containing a string value.

Method Summary

String
getAsString()
Returns the string representation of this model.
String
toString()

Constructor Details

SimpleScalar

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

Method Details

getAsString

public String getAsString()
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 String toString()