|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.template.expression.Ternary
public final class Ternary
An expression that represents a conditional ternary operator. Most useful in conjunction with the lambda operator.
Constructor Summary | |
---|---|
Ternary()
Create a new Ternary expression. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
Determines whether this object is equal to the given object. |
TemplateModel |
getAsTemplateModel(TemplateWriteableHashModel modelRoot)
Performs ternary evaluation. |
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()
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. |
void |
setElseExpression(Expression expr)
Sets the expression to be evaluates if the test evaluates to false. |
void |
setIfExpression(Expression expr)
Sets the expression to be evaluated if the test evaluates to true. |
void |
setTest(Expression expr)
Sets the test expression for this ternary operator. |
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 Ternary()
Method Detail |
---|
public void setTest(Expression expr)
expr
- the expression to be tested to determine which result
should be evaluatedpublic void setIfExpression(Expression expr)
expr
- the expression to be evaluated if the test expression
evaluates truepublic void setElseExpression(Expression expr)
expr
- the expressoin to be evaluated if the test expression
evaluates falsepublic TemplateModel getAsTemplateModel(TemplateWriteableHashModel modelRoot) throws TemplateException
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.util.Set<ExpressionUtils.ExpressionType> getType()
ExpressionUtils
class.
getType
in interface Expression
public boolean isComplete()
Expression
complete?
isComplete
in interface Expression
true
if this Expression
is complete,
otherwise false
public boolean isConstant()
isConstant
in interface Expression
public ExpressionBuilder.Precedence getPrecedence()
getPrecedence
in interface Operator
public Expression resolveExpression() throws TemplateException
resolveExpression
in interface Expression
TemplateException
public java.lang.String toString()
toString
in class java.lang.Object
String
representation of this 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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |