freemarker.template.expression
Class AbstractBinary

java.lang.Object
  extended by freemarker.template.expression.AbstractBinary
All Implemented Interfaces:
Binary, Expression, Operator, java.io.Serializable
Direct Known Subclasses:
And, Divide, Equals, GreaterThan, GreaterThanOrEquals, LessThan, LessThanOrEquals, Minus, Modulo, Multiply, NotEquals, Or, Plus

public abstract class AbstractBinary
extends java.lang.Object
implements Binary, java.io.Serializable

Abstract class that implements most of the surrounding machinery needed for binary expressions. This turns out to be identical for all binary operators, so is consolidated into this one abstract class.

Version:
$Id: AbstractBinary.java 1101 2013-04-01 04:17:32Z run2000 $
See Also:
Serialized Form

Field Summary
protected  Expression left
          The left-hand side of the expression to be evaluated.
protected  Expression right
          The right-hand side of the expression to be evaluated.
 
Constructor Summary
AbstractBinary()
          Default constructor.
 
Method Summary
 boolean isComplete()
          Is the Expression complete?
 Expression resolveExpression()
          Resolves the current expression, possibly into a different expression object.
 void setLeft(Expression left)
          Sets the left-hand side of the expression.
 void setRight(Expression right)
          Sets the right-hand side of the expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface freemarker.template.expression.Operator
getPrecedence
 
Methods inherited from interface freemarker.template.expression.Expression
getAsTemplateModel, getType, isConstant
 

Field Detail

left

protected Expression left
The left-hand side of the expression to be evaluated.


right

protected Expression right
The right-hand side of the expression to be evaluated.

Constructor Detail

AbstractBinary

public AbstractBinary()
Default constructor.

Method Detail

setLeft

public void setLeft(Expression left)
Sets the left-hand side of the expression.

Specified by:
setLeft in interface Binary
Parameters:
left - the left-hand side of the expression
Throws:
java.lang.NullPointerException - the argument was null

setRight

public void setRight(Expression right)
Sets the right-hand side of the expression.

Specified by:
setRight in interface Binary
Parameters:
right - the right-hand side of the expression
Throws:
java.lang.NullPointerException - the argument was null

isComplete

public boolean isComplete()
Is the Expression complete?

Specified by:
isComplete in interface Expression
Returns:
true if both left and right sides of the expression are specified, otherwise false

resolveExpression

public Expression resolveExpression()
                             throws TemplateException
Resolves the current expression, possibly into a different expression object. Situations where this may be used are:

Specified by:
resolveExpression in interface Expression
Throws:
TemplateException