net.sourceforge.pbeans
Class SimpleOperator

java.lang.Object
  extended by net.sourceforge.pbeans.SimpleOperator
All Implemented Interfaces:
Operator

public final class SimpleOperator
extends java.lang.Object
implements Operator

SimpleOperator generates a simple operation on two expressions. The two given expressions are simply concatenated with operation (specified in constructor) between them. Note: objects of this class are immutable (i.e. once created they cannot be changed).

Author:
Marius Siegas

Field Summary
 
Fields inherited from interface net.sourceforge.pbeans.Operator
EQUALS, GREATER_THAN, IN, IS, LESS_THAN, LIKE
 
Constructor Summary
SimpleOperator(java.lang.String operation)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compares this simple operation to other object.
 java.lang.String operation(java.lang.String variable, java.lang.String value)
          Generates SQL operation using given expressions as arguments.
 java.lang.String operatorString()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleOperator

public SimpleOperator(java.lang.String operation)
Method Detail

operation

public java.lang.String operation(java.lang.String variable,
                                  java.lang.String value)
Description copied from interface: Operator
Generates SQL operation using given expressions as arguments. The resulting string should containt the two specified strings in it. Also there must be enough spacing around operation (if needed) for it not to collapse with expressions.

Specified by:
operation in interface Operator
Parameters:
variable - variable expression (i.e. left-hand expression).
value - value expression (i.e. right-hand expression).
Returns:
generated string containing variable, value and the operation(-s) performed on them.

equals

public boolean equals(java.lang.Object obj)
Compares this simple operation to other object. The result is true if and only if the given object is SimpleOperator and its operation string equals to the operation string of this object.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

operatorString

public java.lang.String operatorString()
Specified by:
operatorString in interface Operator