com.im.df.api 5.8

com.im.df.api.dml
Class DFTermExpression

java.lang.Object
  extended by com.im.df.api.dml.DFTerm
      extended by com.im.df.api.dml.DFTermExpression

public final class DFTermExpression
extends DFTerm

This object represents a complex expression. It consists of operator and zero to more operands. In addition it can contain some options which are specific parameters to this expression. These options are not standardized.

The object is immutable, the value cannot be changed once the object is created. Currently it doesn't have public constructor nor create method. If you want to use this object you can create using DFTermsFactory static methods.


Field Summary
static DFTermExpression ALL_DATA
          The constant which represents all data.
 
Method Summary
 void accept(DFTermVisitor visitor)
           
 DFTermExpression changeOperator(DFOperator newOperator)
          Change the operator for this expression and return new changed instance of this expression.
 DFTermExpression changeOptions(Map<String,Object> newOptions)
          Change the options of this expression.
 boolean equals(Object obj)
           
 int getIndexOfOperand(DFTerm operand)
          Get index of the operand.
 List<DFTerm> getOperands()
          Gets the list of operands.
 DFOperator getOperator()
          Gets the operator.
 Map<String,Object> getOptions()
          Gets the options of the expression.
 Class<? extends DFFieldDataTypeCapability> getTermReturnType()
          Compute the return type of the term.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class com.im.df.api.dml.DFTerm
validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ALL_DATA

public static final DFTermExpression ALL_DATA
The constant which represents all data. In SQL it means "SELECT * FROM SOME_TABLE".

Method Detail

changeOperator

public DFTermExpression changeOperator(DFOperator newOperator)
Change the operator for this expression and return new changed instance of this expression.

Parameters:
newOperator - New operator must be only in the same group of operators. If the previous operator was logical (AND/OR), the new one must be from the same category otherwise the method will throw an exception. The same for structural operators.
Returns:
New expression with the same operands and the same options.

changeOptions

public DFTermExpression changeOptions(Map<String,Object> newOptions)
Change the options of this expression. As this object immutable it returns a new instance with changed options

Parameters:
newOptions - New options
Returns:
The new instance of DFTermExpression with replaced options.

getOperator

public DFOperator getOperator()
Gets the operator.

Returns:
Operator for this expression. Never returns null.

getOperands

public List<DFTerm> getOperands()
Gets the list of operands.

Returns:
The list of operands. Never returns null.

getIndexOfOperand

public int getIndexOfOperand(DFTerm operand)
Get index of the operand.

Parameters:
operand - The operand which you are looking for
Returns:
The index of the given operand or -1 if the operand cannot be found.

getOptions

public Map<String,Object> getOptions()
Gets the options of the expression.

Returns:
The options

getTermReturnType

public Class<? extends DFFieldDataTypeCapability> getTermReturnType()
Compute the return type of the term. Can return null if it cannot be determined. DFTermExpression implementation asks operator to determine the return type according to current operands. For example operator LESS_THAN can have return type DFFieldTextCapability, DFFieldIntegerCapability or others depending on the operands filled there.

Specified by:
getTermReturnType in class DFTerm
Returns:
The class which is subclass of DFFieldDataTypeCapability or null

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

accept

public void accept(DFTermVisitor visitor)
Specified by:
accept in class DFTerm

com.im.df.api 5.8