freemarker.template.expression
Class StringLiteral

java.lang.Object
  |
  +--freemarker.template.expression.StringLiteral
All Implemented Interfaces:
Expression, ExpressionElement, java.io.Serializable

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

Represents a String literal in a FM-Classic template.

Version:
$Id: StringLiteral.java,v 1.21 2003/11/27 07:07:12 run2000 Exp $
See Also:
Serialized Form

Constructor Summary
StringLiteral(java.lang.String value)
          Constructor that takes the String value to be generated at run time.
 
Method Summary
 boolean equals(java.lang.Object o)
          Override the Object.equals method.
 TemplateModel getAsTemplateModel(TemplateModelRoot modelRoot)
          Retrieve the value of this StringLiteral as a TemplateModel.
 int getType()
          Determine the type of result that can be calculated by this expression.
 int hashCode()
          Retrieve the hash value for this object.
 boolean isComplete()
          Does the StringLiteral contain a value?
 java.lang.String toString()
          Return the String value of this string literal.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringLiteral

public StringLiteral(java.lang.String value)
Constructor that takes the String value to be generated at run time.
Parameters:
value - the String value to be generated
Throws:
NullPointerException - the value is null
Method Detail

getAsTemplateModel

public TemplateModel getAsTemplateModel(TemplateModelRoot modelRoot)
Retrieve the value of this StringLiteral as a TemplateModel.
Specified by:
getAsTemplateModel in interface Expression
Parameters:
modelRoot - the template model that will be evaluated by the expression
Returns:
a FastScalar containing the literal String

isComplete

public boolean isComplete()
Does the StringLiteral contain a value?
Specified by:
isComplete in interface Expression
Returns:
true if there is a value, otherwise false

getType

public int 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

toString

public java.lang.String toString()
Return the String value of this string literal.
Overrides:
toString in class java.lang.Object
Returns:
the value of this literal as a String object

equals

public boolean equals(java.lang.Object o)
Override the Object.equals method.
Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare against
Returns:
true if the two objects are equal, otherwise false

hashCode

public int hashCode()
Retrieve the hash value for this object.
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code corresponding to the value of this object