public final class SimpleScalar extends Object implements TemplateScalarModel, Serializable
This class is thread-safe.
SimpleSequence
,
SimpleHash
,
Serialized FormEMPTY_STRING
NOTHING
Constructor and Description |
---|
SimpleScalar(String value)
Constructs a SimpleScalar containing a string value.
|
Modifier and Type | Method and Description |
---|---|
String |
getAsString()
Returns the string representation of this model.
|
static SimpleScalar |
newInstanceOrNull(String s)
Same as calling the constructor, except that for a
null parameter it returns null. |
String |
toString() |
public SimpleScalar(String value)
value
- the string value. If this is null
, its value in FTL will be ""
.public String getAsString()
TemplateScalarModel
null
, as that will cause exception. (In
classic-compatible mode the engine will convert null
into empty string, though.)
Objects of this type should be immutable, that is, calling TemplateScalarModel.getAsString()
should always return the same
value as for the first time.
getAsString
in interface TemplateScalarModel
public static SimpleScalar newInstanceOrNull(String s)
null
parameter it returns null.