static class ExpressionNode.BinaryExpressionNode extends ExpressionNode
#set ($a = $b + $c)
, this will be the type
of the node representing $b + $c
.ExpressionNode.BinaryExpressionNode, ExpressionNode.NotExpressionNode
Modifier and Type | Field and Description |
---|---|
(package private) ExpressionNode |
lhs |
(package private) Parser.Operator |
op |
(package private) ExpressionNode |
rhs |
lineNumber
Constructor and Description |
---|
BinaryExpressionNode(ExpressionNode lhs,
Parser.Operator op,
ExpressionNode rhs) |
Modifier and Type | Method and Description |
---|---|
private boolean |
equal(EvaluationContext context)
Returns true if
lhs and rhs are equal according to Velocity. |
(package private) java.lang.Object |
evaluate(EvaluationContext context)
Returns the result of evaluating this node in the given context.
|
intValue, isDefinedAndTrue, isTrue
cons, emptyNode, evaluationException, evaluationException
final ExpressionNode lhs
final Parser.Operator op
final ExpressionNode rhs
BinaryExpressionNode(ExpressionNode lhs, Parser.Operator op, ExpressionNode rhs)
java.lang.Object evaluate(EvaluationContext context)
Node
2 + 3
to 5 in order to set
$x
to 5 in #set ($x = 2 + 3)
. Or it may be used directly as part of the
template output, for example evaluating replacing name
by Fred
in
My name is $name.
.private boolean equal(EvaluationContext context)
lhs
and rhs
are equal according to Velocity.
Velocity's definition
of equality differs depending on whether the objects being compared are of the same
class. If so, equality comes from Object.equals
as you would expect. But if they
are not of the same class, they are considered equal if their toString()
values are
equal. This means that integer 123 equals long 123L and also string "123"
. It also
means that equality isn't always transitive. For example, two StringBuilder objects each
containing "123"
will not compare equal, even though the string "123"
compares equal to each of them.