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
NOTHINGFields inherited from interface freemarker.template.TemplateScalarModel
EMPTY_STRING -
Constructor Summary
ConstructorsConstructorDescriptionSimpleScalar(String value)Constructs aSimpleScalarcontaining a string value. -
Method Summary
Modifier and TypeMethodDescriptionReturns theStringrepresentation of this model.static SimpleScalarSame as calling the constructor, except that for anullparameter it returns null.toString()
-
Constructor Details
-
SimpleScalar
Constructs aSimpleScalarcontaining a string value.- Parameters:
value- the string value. If this isnull, its value in FTL will be"".
-
-
Method Details
-
getAsString
Description copied from interface:TemplateScalarModelReturns theStringrepresentation of this model. Returningnullis illegal, and may cause exception in the calling code. (Except, in classic-compatible mode the engine will convertnullinto empty string.)- Specified by:
getAsStringin interfaceTemplateScalarModel
-
toString
-
newInstanceOrNull
Same as calling the constructor, except that for anullparameter it returns null.- Since:
- 2.3.23
-