Package freemarker.template
Class SimpleScalar
java.lang.Object
freemarker.template.SimpleScalar
- All Implemented Interfaces:
TemplateModel
,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
-
Field Summary
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
Fields inherited from interface freemarker.template.TemplateScalarModel
EMPTY_STRING
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleScalar(String value)
Constructs aSimpleScalar
containing a string value. -
Method Summary
Modifier and TypeMethodDescriptionReturns theString
representation of this model.static SimpleScalar
Same as calling the constructor, except that for anull
parameter it returns null.toString()
-
Constructor Details
-
SimpleScalar
Constructs aSimpleScalar
containing a string value.- Parameters:
value
- the string value. If this isnull
, its value in FTL will be""
.
-
-
Method Details
-
getAsString
Description copied from interface:TemplateScalarModel
Returns theString
representation of this model. Returningnull
is illegal, and may cause exception in the calling code. (Except, in classic-compatible mode the engine will convertnull
into empty string.)- Specified by:
getAsString
in interfaceTemplateScalarModel
-
toString
-
newInstanceOrNull
Same as calling the constructor, except that for anull
parameter it returns null.- Since:
- 2.3.23
-