Package freemarker.template
Class SimpleScalar
- java.lang.Object
-
- 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.
- 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
Constructors Constructor Description SimpleScalar(java.lang.String value)Constructs a SimpleScalar containing a string value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAsString()Returns theStringrepresentation of this model.static SimpleScalarnewInstanceOrNull(java.lang.String s)Same as calling the constructor, except that for anullparameter it returns null.java.lang.StringtoString()
-
-
-
Method Detail
-
getAsString
public java.lang.String 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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
newInstanceOrNull
public static SimpleScalar newInstanceOrNull(java.lang.String s)
Same as calling the constructor, except that for anullparameter it returns null.- Since:
- 2.3.23
-
-