|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.stc.eindex.ejb.query.Condition
The Condition class represents a condition in the WHERE clause of a SQL statement that is used to build a query object. Each condition in the clause requires a different instance of the Condition class. A condition contains a field name, an operator, and one or more values for the field. By default, conditions are joined to each other by AND operators, but you can specify OR by using the addConditions method and specifying "OR" as the join type. A Condition objet can be a condition container that includes both a left condition and a list of right conditions. By using the appropriate methods, you can build a next OR/AND condition tree.
For example, to create the condition statement "Enterprise.SystemSBR.Person.FirstName = John OR Enterprise.SystemSBR.Person.FirstName = James", use the following methods.
Condition condition = new Condition ("Enterprise.SystemSBR.Person.FirstName",
"=", "John", true);
condition.addConditions("OR", new Condition("Enterprise.SystemSBR.Person.FirstName",
"=", "James", true));
Constructor Summary | |
Condition(Condition condition)
This a copy constructor for the Condition class and creates a copy of the specified condition object enclosed in parenthesis. |
|
Condition(java.lang.String field,
java.lang.Object value)
Creates a new instance of the Condition class where the operator is = (equals) by default. |
|
Condition(java.lang.String field,
java.lang.String operator,
java.lang.Object value)
Creates a new instance of the Condition class. |
|
Condition(java.lang.String field,
java.lang.String operator,
java.lang.Object[] values)
Creates a new instance of the Condition class that uses an array of values, and only supports the IN operator. |
|
Condition(java.lang.String field,
java.lang.String operator,
java.lang.Object[] values,
boolean prepare)
Creates a new instance of the Condition class that uses an array of values, and only supports the IN operator. |
|
Condition(java.lang.String field,
java.lang.String operator,
java.lang.Object value,
boolean prepare)
Creates a new instance of the Condition class. |
Method Summary | |
void |
addCondition(java.lang.String joinType,
java.lang.String field,
java.lang.Object value)
Adds a new condition to a generated SQL statement where the operator within the condition is = (equals) by default. |
void |
addCondition(java.lang.String joinType,
java.lang.String field,
java.lang.String operator,
java.lang.Object value)
Adds a new condition to a generated SQL statement. |
void |
addCondition(java.lang.String joinType,
java.lang.String field,
java.lang.String operator,
java.lang.Object[] values)
Adds a new condition to a generated SQL statement using an array of values. |
void |
addCondition(java.lang.String joinType,
java.lang.String field,
java.lang.String operator,
java.lang.Object value,
boolean prepare)
Adds a new condition to a generated SQL statement and specifies whether to bind the value to a prepared statement. |
void |
addConditions(java.lang.String joinType,
Condition condition)
Adds an existing condition to a generated SQL statement. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Condition(Condition condition)
condition
- The Condition object to copy.
public Condition(java.lang.String field, java.lang.Object value)
field
- The qualified field name for the condition (qualified field
names are in the format object_name.field_name).value
- The value for the condition (do not use quotes).
public Condition(java.lang.String field, java.lang.String operator, java.lang.Object value)
field
- The qualified field name for the condition (qualified field
names are in the format object_name.field_name).operator
- The operator for the condition. Supported operators include
LIKE, =, >, <, >=, and <=.value
- The value for the condition (do not use quotes).
public Condition(java.lang.String field, java.lang.String operator, java.lang.Object[] values)
field
- The qualified field name for the condition (qualified field
names are in the format object_name.field_name).operator
- The condition operator (currently, IN is the only supported
operator).values
- An array of values for the condition.
public Condition(java.lang.String field, java.lang.String operator, java.lang.Object[] values, boolean prepare)
field
- The qualified field name for the condition (qualified field
names are in the format object_name.field_name).operator
- The condition operator (currently, IN is the only supported
operator).values
- An array of values for the condition.prepare
- A Boolean indicator of whether to bind the values to a prepared
statement. Specify true to bind the values; otherwise specify
false.
public Condition(java.lang.String field, java.lang.String operator, java.lang.Object value, boolean prepare)
field
- The qualified field name for the condition (qualified field
names are in the format object_name.field_name).operator
- The condition operator. Supported operators include
LIKE, =, >, and <.value
- The value for the condition (do not use quotes).prepare
- A Boolean indicator of whether to bind the values to a
prepared statement. Specify true to bind the values; otherwise
specify false.
Method Detail |
public void addCondition(java.lang.String joinType, java.lang.String field, java.lang.Object value)
joinType
- The type of join operator to use between this condition and
the previous one.field
- The qualified field name for the condition (qualified field
names are in the format object_name.field_name.value
- The value for the condition (do not use quotes).
void
- None.
public void addCondition(java.lang.String joinType, java.lang.String field, java.lang.String operator, java.lang.Object value)
joinType
- The type of join operator to use between this condition
and the previous one.field
- The qualified field name for the condition (qualified field
names are in the format object_name.field_name).operator
- The condition operator. Supported operators include
LIKE, =, >, and <.value
- The value for the condition (do not use quotes).
void
- None.
public void addCondition(java.lang.String joinType, java.lang.String field, java.lang.String operator, java.lang.Object[] values)
joinType
- The type of join operator to use between this condition
and the previous one.field
- The qualified field name for the condition (qualified field
names are in the format object_name.field_name).operator
- The condition operator (currently, IN is the only supported
operator).values
- An array of values for the condition.
void
- None.
public void addCondition(java.lang.String joinType, java.lang.String field, java.lang.String operator, java.lang.Object value, boolean prepare)
joinType
- The type of join operator to use between this condition
and the previous one.field
- The qualified field name for the condition (qualified field
names are in the format object_name.field_name).operator
- The condition operator. Supported operators include
LIKE, =, >, and <.value
- The value for the condition.prepare
- A Boolean indicator of whether bind the value to a prepared
statement. Specify true to bind the value; otherwise specify
false.
void
- None.
public void addConditions(java.lang.String joinType, Condition condition)
joinType
- The type of join operator to use between this condition
and the previous one.condition
- The condition to add to the statement.
void
- None.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2007 by Sun Microsystems, Inc. All Rights Reserved.