Class ExpressionNode.BinaryExpressionNode
- java.lang.Object
-
- com.google.auto.value.processor.escapevelocity.Node
-
- com.google.auto.value.processor.escapevelocity.ExpressionNode
-
- com.google.auto.value.processor.escapevelocity.ExpressionNode.BinaryExpressionNode
-
- Enclosing class:
- ExpressionNode
static class ExpressionNode.BinaryExpressionNode extends ExpressionNode
Represents all binary expressions. In#set ($a = $b + $c)
, this will be the type of the node representing$b + $c
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.auto.value.processor.escapevelocity.ExpressionNode
ExpressionNode.BinaryExpressionNode, ExpressionNode.NotExpressionNode
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ExpressionNode
lhs
(package private) Parser.Operator
op
(package private) ExpressionNode
rhs
-
Fields inherited from class com.google.auto.value.processor.escapevelocity.Node
lineNumber, resourceName
-
-
Constructor Summary
Constructors Constructor Description BinaryExpressionNode(ExpressionNode lhs, Parser.Operator op, ExpressionNode rhs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
equal(EvaluationContext context)
Returns true iflhs
andrhs
are equal according to Velocity.(package private) java.lang.Object
evaluate(EvaluationContext context)
Returns the result of evaluating this node in the given context.-
Methods inherited from class com.google.auto.value.processor.escapevelocity.ExpressionNode
intValue, isDefinedAndTrue, isTrue
-
Methods inherited from class com.google.auto.value.processor.escapevelocity.Node
cons, emptyNode, evaluationException, evaluationException
-
-
-
-
Field Detail
-
lhs
final ExpressionNode lhs
-
op
final Parser.Operator op
-
rhs
final ExpressionNode rhs
-
-
Constructor Detail
-
BinaryExpressionNode
BinaryExpressionNode(ExpressionNode lhs, Parser.Operator op, ExpressionNode rhs)
-
-
Method Detail
-
evaluate
java.lang.Object evaluate(EvaluationContext context)
Description copied from class:Node
Returns the result of evaluating this node in the given context. This result may be used as part of a further operation, for example evaluating2 + 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 replacingname
byFred
inMy name is $name.
.
-
equal
private boolean equal(EvaluationContext context)
Returns true iflhs
andrhs
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 theirtoString()
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.
-
-