freemarker.template.expression
Class EmptyLiteral

java.lang.Object
  extended by freemarker.template.expression.EmptyLiteral
All Implemented Interfaces:
Expression, java.io.Serializable

public final class EmptyLiteral
extends java.lang.Object
implements Expression, java.io.Serializable

Represents an empty literal in a FM-Classic template. Typically used to support the "#empty" identifier.

Since:
1.9
Version:
$Id: EmptyLiteral.java 1162 2013-04-20 12:04:32Z run2000 $
See Also:
Serialized Form

Field Summary
static EmptyLiteral EMPTY
          The canonical instance of this class.
 
Method Summary
 TemplateModel getAsTemplateModel(TemplateWriteableHashModel modelRoot)
          Retrieve the value of this EmptyLiteral as a TemplateModel.
 EmptyLiteral getInstance()
          Factory method for retrieving instances of a EmptyLiteral.
 java.util.Set<ExpressionUtils.ExpressionType> getType()
          Determine the type of result that can be calculated by this expression.
 boolean isComplete()
          Is the Expression complete?
 boolean isConstant()
          Determine whether result calculated by this expression is a constant value.
 Expression resolveExpression()
          Resolves the current expression, possibly into a different expression object.
 java.lang.String toString()
          Retrieve the value of this object as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final EmptyLiteral EMPTY
The canonical instance of this class.

Method Detail

getAsTemplateModel

public TemplateModel getAsTemplateModel(TemplateWriteableHashModel modelRoot)
                                 throws TemplateException
Retrieve the value of this EmptyLiteral as a TemplateModel.

Specified by:
getAsTemplateModel in interface Expression
Parameters:
modelRoot - the template model that will be evaluated by the expression
Throws:
TemplateException - the expression could not be evaluated for some reason

isComplete

public boolean isComplete()
Is the Expression complete?

Specified by:
isComplete in interface Expression
Returns:
true if this Expression is complete, otherwise false

getType

public java.util.Set<ExpressionUtils.ExpressionType> getType()
Determine the type of result that can be calculated by this expression. This is in the form of an integer constant ored together from values in the ExpressionUtils class.

Specified by:
getType in interface Expression

isConstant

public boolean isConstant()
Determine whether result calculated by this expression is a constant value.

Specified by:
isConstant in interface Expression

getInstance

public EmptyLiteral getInstance()
Factory method for retrieving instances of a EmptyLiteral.


toString

public java.lang.String toString()
Retrieve the value of this object as a String.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of this expression

resolveExpression

public Expression resolveExpression()
                             throws TemplateException
Resolves the current expression, possibly into a different expression object. This is loosely equivalent to the serialization protocol's readResolve method. Situations where this may be used are:

Specified by:
resolveExpression in interface Expression
Throws:
TemplateException