freemarker.template
Class SimpleScalar
java.lang.Object
|
+--freemarker.template.compiler.TemplateObject
|
+--freemarker.template.compiler.Expression
|
+--freemarker.template.SimpleScalar
- All Implemented Interfaces:
- java.io.Serializable, TemplateModel, TemplateScalarModel
- public final class SimpleScalar
- extends Expression
- implements TemplateScalarModel, java.io.Serializable
A simple implementation of the TemplateScalarModel
interface, using a String or a boolean.
As of version 2.0 this object is immutable.
- Version:
- $Id: SimpleScalar.java,v 1.16 2002/04/26 17:35:18 revusky Exp $
- See Also:
SimpleSequence
,
SimpleHash
, Serialized Form
Constructor Summary |
SimpleScalar(boolean value)
Constructs a SimpleScalar containing a boolean value. |
SimpleScalar(java.lang.String value)
Constructs a SimpleScalar containing a string value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
TRUE
public static final SimpleScalar TRUE
FALSE
public static final SimpleScalar FALSE
SimpleScalar
public SimpleScalar(java.lang.String value)
- Constructs a SimpleScalar containing a string value.
- Parameters:
value
- the string value.
SimpleScalar
public SimpleScalar(boolean value)
- Constructs a SimpleScalar containing a boolean value.
- Parameters:
value
- the boolean value.
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface TemplateModel
- Following copied from interface:
freemarker.template.TemplateModel
- Returns:
- true if this object is empty.
getAsString
public java.lang.String getAsString(java.util.Locale locale)
- Note that this implementation does not
use the locale parameter.
- Specified by:
getAsString
in interface TemplateScalarModel
isTrue
public boolean isTrue(TemplateModelRoot modelRoot)
- Overrides:
isTrue
in class Expression
getStringValue
public java.lang.String getStringValue(TemplateModelRoot modelRoot)
- Overrides:
getStringValue
in class Expression
getNumericalValue
public java.lang.Number getNumericalValue(TemplateModelRoot modelRoot)
throws TemplateException
isNumerical
public boolean isNumerical(TemplateModelRoot modelRoot)
- Always returns false.
getAsTemplateModel
public TemplateModel getAsTemplateModel(TemplateModelRoot modelRoot)
- Overrides:
getAsTemplateModel
in class Expression
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object