|
Compoze Software, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.compoze.exchange.webdav.sql.AbstractSqlFragment | +--com.compoze.exchange.webdav.sql.Condition
This class provides the implementation for creating a condition statement.
The following example demonstrates how to use this class:
Condition cond = Condition.create(new GreaterThanOperator("urn:schemas:contacts:givenName", "Skip"), true); cond.add(new GreaterThanOperator("urn:schemas:contacts:givenName", "Skippy"), true); System.out.println(cond);
Calling toSQL()
or toString()
will return the SQL representation of this object.
For example, the above example would yield:
("urn:schemas:contacts:givenName" > 'Skip') OR ("urn:schemas:contacts:givenName" > 'Skippy')
Constructor Summary | |
protected |
Condition()
Constructor. |
protected |
Condition(Condition condition,
boolean bOr)
Constructor. |
protected |
Condition(IOperator op,
boolean bOr)
Constructor. |
protected |
Condition(IPredicate predicate,
boolean bOr)
Constructor. |
Method Summary | |
void |
add(Condition condition)
Adds a condition statement. |
void |
add(Condition condition,
boolean bOr)
Adds a condition statement. |
void |
add(IOperator op)
Adds an operator clause. |
void |
add(IOperator op,
boolean bOr)
Adds an operator clause. |
void |
add(IPredicate predicate)
Adds a predicate clause. |
void |
add(IPredicate predicate,
boolean bOr)
Adds a predicate clause. |
static Condition |
create()
Creates an empty condition statement. |
static Condition |
create(Condition condition)
Creates a condition with a specfied condition statement. |
static Condition |
create(Condition condition,
boolean bOr)
Creates a condition with a specfied condition statement. |
static Condition |
create(IOperator op)
Creates a condition with a specfied operator clause. |
static Condition |
create(IOperator op,
boolean bOr)
Creates a condition with a specfied operator clause. |
static Condition |
create(IPredicate predicate)
Creates a condition with a specfied predicate clause. |
static Condition |
create(IPredicate predicate,
boolean bOr)
Creates a condition with a specfied predicate clause. |
ISqlFragment |
getCondition()
Gets the condition statement. |
boolean |
isEmpty()
Checks whether this condition contains sub-conditions. |
boolean |
isOr()
Checks whether this condition is 'OR'd. |
static void |
main(java.lang.String[] args)
|
java.lang.String |
toSQL()
Returns a SQL representation of the condition statement. |
Methods inherited from class com.compoze.exchange.webdav.sql.AbstractSqlFragment |
escape, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected Condition()
protected Condition(Condition condition, boolean bOr)
condition
- the condition statement.bOr
- true
to or together; false
otherwise.protected Condition(IOperator op, boolean bOr)
op
- the operator statement.bOr
- true
to or together; false
otherwise.protected Condition(IPredicate predicate, boolean bOr)
predicate
- the predicate statement.bOr
- true
to or together; false
otherwise.Method Detail |
public boolean isEmpty()
true
if this condition contains no sub-conditions;
false
otherwise.public boolean isOr()
true
if this condition is 'OR'd; false
otherwise.public ISqlFragment getCondition()
public static Condition create()
public static Condition create(Condition condition)
condition
- the condition statement to create condition with.public static Condition create(Condition condition, boolean bOr)
condition
- the condition statement to create condition with.bOr
- true
to or together; false
otherwise.public static Condition create(IOperator op)
op
- the operator clause to create condition with.public static Condition create(IOperator op, boolean bOr)
op
- the operator clause to create condition with.bOr
- true
to or together; false
otherwise.public static Condition create(IPredicate predicate)
predicate
- the predicate clause to create condition with.bOr
- true
to or together; false
otherwise.public static Condition create(IPredicate predicate, boolean bOr)
predicate
- the predicate clause to create condition with.bOr
- true
to or together; false
otherwise.public void add(Condition condition)
condition
- the condition statemnt to add.public void add(Condition condition, boolean bOr)
condition
- the condition statemnt to add.bOr
- true
to or together; false
otherwise.public void add(IOperator op)
op
- the operator clause to add.public void add(IOperator op, boolean bOr)
op
- the operator clause to add.bOr
- true
to or together; false
otherwise.public void add(IPredicate predicate)
predicate
- the predicate clause to add.public void add(IPredicate predicate, boolean bOr)
predicate
- the predicate clause to add.bOr
- true
to or together; false
otherwise.public java.lang.String toSQL()
toSQL
in interface ISqlFragment
toSQL
in class AbstractSqlFragment
public static void main(java.lang.String[] args)
|
Compoze Software, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |