semorg.sql.util
Class DBConstraint

java.lang.Object
  extended by semorg.sql.util.DBConstraint

public class DBConstraint
extends Object

Models a condition of a WHERE-clause, which is structured as follows

< columnName > < relation > < value > < conjunction >,

whereas:


Field Summary
private  String columnName
          The name of the column which is restricted by the conjunction.
static int CONJ_AND
          AND conjunction.
static int CONJ_END
          This conjunction type marks the end of chain of conjunctions.
static int CONJ_OR
          OR conjunction.
private  int conjunction
          Conjunction, which appears AFTER the condition (possibly none).
static int REL_EQ
          Equality relation.
static int REL_GREATER
          "Greater Than" relation.
static int REL_LESS
          "Less Than" relation.
static int REL_LIKE
          LIKE relation.
static int REL_NEQ
          Inequality relation.
private  int relation
          Relation (<, >, !
private  Object value
          The value, which restricts the attribute.
 
Constructor Summary
DBConstraint(String columnName, int relation, Object value, int conjunction)
          Creates a DBConstraint instance with the given values.
 
Method Summary
 String getColumnName()
           
 int getConjunction()
           
static int getConjunction(String conjunctionString)
          Return for given conjunction string the appropriate conjunction constant.
 int getRelation()
           
static int getRelation(String relationString)
          Returns for a given relation string the appropriate relation constant.
 Object getValue()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REL_EQ

public static final int REL_EQ
Equality relation.

See Also:
Constant Field Values

REL_NEQ

public static final int REL_NEQ
Inequality relation.

See Also:
Constant Field Values

REL_LESS

public static final int REL_LESS
"Less Than" relation.

See Also:
Constant Field Values

REL_GREATER

public static final int REL_GREATER
"Greater Than" relation.

See Also:
Constant Field Values

REL_LIKE

public static final int REL_LIKE
LIKE relation.

See Also:
Constant Field Values

CONJ_END

public static final int CONJ_END
This conjunction type marks the end of chain of conjunctions.

See Also:
Constant Field Values

CONJ_AND

public static final int CONJ_AND
AND conjunction.

See Also:
Constant Field Values

CONJ_OR

public static final int CONJ_OR
OR conjunction.

See Also:
Constant Field Values

columnName

private String columnName
The name of the column which is restricted by the conjunction.


relation

private int relation
Relation (<, >, !=, =, ~) between attribute and value.


value

private Object value
The value, which restricts the attribute.


conjunction

private int conjunction
Conjunction, which appears AFTER the condition (possibly none).

Constructor Detail

DBConstraint

public DBConstraint(String columnName,
                    int relation,
                    Object value,
                    int conjunction)
Creates a DBConstraint instance with the given values.

Parameters:
columnName - name of the attribute which should be restricted.
relation - Relation between attribute and value.
value - Value to restrict the attribute.
conjunction - Conjunction, which appears AFTER the condition.
Method Detail

getColumnName

public String getColumnName()

getConjunction

public int getConjunction()

getRelation

public int getRelation()

getValue

public Object getValue()

getRelation

public static int getRelation(String relationString)
Returns for a given relation string the appropriate relation constant.

Parameters:
relationString - a string, which contains one of the operators <,>,~,!=, =.

getConjunction

public static int getConjunction(String conjunctionString)
Return for given conjunction string the appropriate conjunction constant.

Parameters:
conjunctionString - String containing a conjunction like "and" / "or".