Package freemarker.template
Class SimpleScalar
- java.lang.Object
-
- freemarker.template.SimpleScalar
-
- All Implemented Interfaces:
TemplateModel,TemplateScalarModel,Serializable
public final class SimpleScalar extends 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.
- See Also:
SimpleSequence,SimpleHash, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface freemarker.template.TemplateModel
TemplateModel.InvalidExpressionModel, TemplateModel.JavaNull
-
-
Field Summary
-
Fields inherited from interface freemarker.template.TemplateModel
INVALID_EXPRESSION, JAVA_NULL, NOTHING
-
Fields inherited from interface freemarker.template.TemplateScalarModel
EMPTY_STRING
-
-
Constructor Summary
Constructors Constructor Description SimpleScalar(String value)Constructs a SimpleScalar containing a string value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAsString()Returns the string representation of this model.StringtoString()
-
-
-
Constructor Detail
-
SimpleScalar
public SimpleScalar(String value)
Constructs a SimpleScalar containing a string value.- Parameters:
value- the string value.
-
-
Method Detail
-
getAsString
public String getAsString()
Description copied from interface:TemplateScalarModelReturns 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:
getAsStringin interfaceTemplateScalarModel
-
-