|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.template.expression.Constant
public final class Constant
Represents a constant value within an expression. This is calculated by
the ExpressionBuilder
and stored within the parse tree in place
of a more complex expression. The value is stored as a TemplateModel,
which is returned on demand.
Constructor Summary | |
---|---|
Constant(TemplateModel constantValue)
Creates a new constant expression with the given model as its value. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
Determines whether this object is equal to the given object. |
TemplateModel |
getAsTemplateModel(TemplateWriteableHashModel modelRoot)
The TemplateModel value of this constant Expression . |
java.util.Set<ExpressionUtils.ExpressionType> |
getType()
Determine the type of result that can be calculated by this expression. |
int |
hashCode()
Returns the hash code for this constant 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()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Constant(TemplateModel constantValue)
constantValue
- the value to be returned when a template model
is requested
java.lang.NullPointerException
- the value is nullMethod Detail |
---|
public boolean isComplete()
Expression
complete?
isComplete
in interface Expression
true
since the constant Expression
is
always completepublic java.util.Set<ExpressionUtils.ExpressionType> getType()
ExpressionUtils
class.
getType
in interface Expression
public boolean isConstant()
isConstant
in interface Expression
public TemplateModel getAsTemplateModel(TemplateWriteableHashModel modelRoot) throws TemplateException
TemplateModel
value of this constant Expression
.
getAsTemplateModel
in interface Expression
modelRoot
- the template model that will be evaluated by the expression
TemplateException
- the expression could not be evaluated for some reasonpublic java.lang.String toString()
toString
in class java.lang.Object
String
representation of this constant expressionpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to be compared with
true
if the objects are equal, otherwise
false
public int hashCode()
hashCode
in class java.lang.Object
public Expression resolveExpression()
readResolve
method. Situations where this may be used are:
resolveExpression
in interface Expression
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |