|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.template.expression.DynamicKeyName
public final class DynamicKeyName
A unary operator that uses the string value of an expression as a hash key.
It associates with other Variable expressions to its left.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface freemarker.template.expression.Unary |
|---|
Unary.Association |
| Constructor Summary | |
|---|---|
DynamicKeyName(Expression key)
Constructor that takes an Expression used to evaluate the
key name at run time. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
Determines whether this object is equal to the given object. |
Unary.Association |
getAssociationType()
Retrieve the operator association for this operator. |
TemplateModel |
getAsTemplateModel(TemplateWriteableHashModel modelRoot)
Sets the target of this DynamicKeyName operator. |
java.lang.String |
getName(TemplateWriteableHashModel modelRoot)
Retrieve the name of this portion of the variable. |
ExpressionBuilder.Precedence |
getPrecedence()
Return the precedence for this operator to the caller. |
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 operator. |
boolean |
isComplete()
Are both the key name and target specified? |
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. |
void |
setTarget(Expression target)
Sets the target of the dynamic key. |
void |
setTemplateModel(TemplateWriteableHashModel modelRoot,
TemplateModel value)
Implements a write of the given value to a writeable hash model or writeable list model. |
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 DynamicKeyName(Expression key)
Expression used to evaluate the
key name at run time.
key - the expression to be used to evaluate the key name
java.lang.NullPointerException - the key expression was null
java.lang.IllegalArgumentException - the key could not be evaluated as a
number or a String| Method Detail |
|---|
public void setTarget(Expression target)
setTarget in interface Unarytarget - the target of the dynamic key
java.lang.IllegalArgumentException - the expression was not suitable for a
dynamic key name evaluationpublic boolean isComplete()
isComplete in interface Expressiontrue if both target and key name are specified,
otherwise falsepublic java.util.Set<ExpressionUtils.ExpressionType> getType()
ExpressionUtils class.
getType in interface Expressionpublic boolean isConstant()
isConstant in interface Expressionpublic Unary.Association getAssociationType()
getAssociationType in interface UnaryPOSTFIX.
public TemplateModel getAsTemplateModel(TemplateWriteableHashModel modelRoot)
throws TemplateException
DynamicKeyName operator.
getAsTemplateModel in interface ExpressionmodelRoot - the template model that will be evaluated by the expression
TemplateException - the target is of the wrong type
for this operator.
public void setTemplateModel(TemplateWriteableHashModel modelRoot,
TemplateModel value)
throws TemplateException
setTemplateModel in interface VariablemodelRoot - the root model, for determining contextvalue - the value to be assigned
TemplateException - there was a problem performing the assignment
public java.lang.String getName(TemplateWriteableHashModel modelRoot)
throws TemplateException
getName in interface VariablemodelRoot - the model to be used in cases where the variable is
the result of an Expression.
TemplateException - the name could not be determinedpublic ExpressionBuilder.Precedence getPrecedence()
getPrecedence in interface Operatorpublic java.lang.String toString()
toString in class java.lang.ObjectString representation of this expressionpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the object to be compared with
true if the objects are equal, otherwise
falsepublic int hashCode()
hashCode in class java.lang.Objectpublic 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 | ||||||||