org.openanzo.sqlscribe
Class Match

java.lang.Object
  extended by org.openanzo.sqlscribe.Match
All Implemented Interfaces:
Constraint
Direct Known Subclasses:
InMatch, Join, ValueMatch, VariableMatch

public abstract class Match
extends java.lang.Object
implements Constraint

Convenient class for constructing common SQL constraints for use in the query builder framework.

Author:
Joe Betz

Method Summary
static Join equals(Column lhs, Column rhs)
          Create new Join enforcing column equality
static Match equals(Column lhs, java.lang.Object value)
          New Equality constraint between a column and a fixed value
 Column getLhs()
          Get the left hand side of the constraint
 java.lang.String getOperator()
          Get the Operator for this constraint
static Join greater(Column lhs, Column rhs)
          Create new Join enforcing that the left hand column is greater than the right hand column
static Match greater(Column lhs, java.lang.Object value)
          New greater than constraint between a column and a fixed value
static Match in(Column lhs, Column projection, Constraint... rhs)
          Create a new IN constraint
static Match isNotNull(Column lhs)
          Constraint to enforce that a column is not null
static Match isNull(Column lhs)
          Constraint to enforce that a column is null
static Join less(Column lhs, Column rhs)
          Create new Join enforcing that the left hand column is less than the right hand column
static Match less(Column lhs, java.lang.Object value)
          New less than constraint between a column and a fixed value
 java.util.Set<ITable> listTables()
          Get the set of tables to which this constraint is based
static Match varEquals(Column lhs, java.lang.String variableName)
          New Equality constraint between a column and a fixed variableName
static Match varGreater(Column lhs, java.lang.String variableName)
          New greater than constraint between a column and a fixed variableName
static Match varGreaterEquals(Column lhs, java.lang.String variableName)
          New greater than or equals constraint between a column and a fixed variableName
static Match varLess(Column lhs, java.lang.String variableName)
          New less than constraint between a column and a fixed variableName
static Match varLessEquals(Column lhs, java.lang.String variableName)
          New less than or equals constraint between a column and a fixed variableName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openanzo.sqlscribe.Constraint
getConstraint, writeConstraint
 

Method Detail

equals

public static Join equals(Column lhs,
                          Column rhs)
Create new Join enforcing column equality

Parameters:
lhs - left hand column
rhs - right hand column
Returns:
new Join enforcing column equality

less

public static Join less(Column lhs,
                        Column rhs)
Create new Join enforcing that the left hand column is less than the right hand column

Parameters:
lhs - left hand column
rhs - right hand column
Returns:
new Join enforcing that the left hand column is less than the right hand column

greater

public static Join greater(Column lhs,
                           Column rhs)
Create new Join enforcing that the left hand column is greater than the right hand column

Parameters:
lhs - left hand column
rhs - right hand column
Returns:
new Join enforcing that the left hand column is greater than the right hand column

equals

public static Match equals(Column lhs,
                           java.lang.Object value)
New Equality constraint between a column and a fixed value

Parameters:
lhs - left hand column
value - value to match
Returns:
a new Equality constraint between a column and a fixed value

less

public static Match less(Column lhs,
                         java.lang.Object value)
New less than constraint between a column and a fixed value

Parameters:
lhs - left hand column
value - value to match
Returns:
a new less than constraint between a column and a fixed value

greater

public static Match greater(Column lhs,
                            java.lang.Object value)
New greater than constraint between a column and a fixed value

Parameters:
lhs - left hand column
value - value to match
Returns:
a new greater than constraint between a column and a fixed value

varEquals

public static Match varEquals(Column lhs,
                              java.lang.String variableName)
New Equality constraint between a column and a fixed variableName

Parameters:
lhs - left hand column
variableName - value to match
Returns:
a new Equality constraint between a column and a variableName

varLessEquals

public static Match varLessEquals(Column lhs,
                                  java.lang.String variableName)
New less than or equals constraint between a column and a fixed variableName

Parameters:
lhs - left hand column
variableName - name of variable to match
Returns:
a new less than or equals constraint between a column and a variableName

varGreaterEquals

public static Match varGreaterEquals(Column lhs,
                                     java.lang.String variableName)
New greater than or equals constraint between a column and a fixed variableName

Parameters:
lhs - left hand column
variableName - name of variable to match
Returns:
a new greater than or equals constraint between a column and a variableName

varLess

public static Match varLess(Column lhs,
                            java.lang.String variableName)
New less than constraint between a column and a fixed variableName

Parameters:
lhs - left hand column
variableName - name of variable to match
Returns:
a new less than constraint between a column and a variableName

varGreater

public static Match varGreater(Column lhs,
                               java.lang.String variableName)
New greater than constraint between a column and a fixed variableName

Parameters:
lhs - left hand column
variableName - name of variable to match
Returns:
a new greater than constraint between a column and a variableName

isNull

public static Match isNull(Column lhs)
Constraint to enforce that a column is null

Parameters:
lhs - left hand column
Returns:
a new constraint to enforce that a column is null

isNotNull

public static Match isNotNull(Column lhs)
Constraint to enforce that a column is not null

Parameters:
lhs - left hand column
Returns:
a new constraint to enforce that a column is not null

in

public static Match in(Column lhs,
                       Column projection,
                       Constraint... rhs)
Create a new IN constraint

Parameters:
lhs - left side of the constraint
projection - what column should be project out of the right hand side of the query
rhs - the constraints that should be met within the IN sub select
Returns:
a new IN constraint

getLhs

public Column getLhs()
Get the left hand side of the constraint

Returns:
the left hand side of the constraint

listTables

public java.util.Set<ITable> listTables()
Description copied from interface: Constraint
Get the set of tables to which this constraint is based

Specified by:
listTables in interface Constraint
Returns:
the set of tables to which this constraint is based

getOperator

public java.lang.String getOperator()
Get the Operator for this constraint

Returns:
the Operator for this constraint


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.