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
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
FieldsModifier and TypeFieldDescription(package private) final ExpressionNode
(package private) final Parser.Operator
(package private) final ExpressionNode
Fields inherited from class com.google.auto.value.processor.escapevelocity.Node
lineNumber, resourceName
-
Constructor Summary
ConstructorsConstructorDescriptionBinaryExpressionNode
(ExpressionNode lhs, Parser.Operator op, ExpressionNode rhs) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
equal
(EvaluationContext context) Returns true iflhs
andrhs
are equal according to Velocity.(package private) 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 Details
-
lhs
-
op
-
rhs
-
-
Constructor Details
-
BinaryExpressionNode
BinaryExpressionNode(ExpressionNode lhs, Parser.Operator op, ExpressionNode rhs)
-
-
Method Details
-
evaluate
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
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.
-