|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.brains2b.data.Condition
public abstract class Condition
Abstract class defining a condition on a datastore.
The condition can be either an equals method for an identifier or an order by clause for your data.
Write an implementation for specific datastores by implementing the getCondition() to be executed as the query part for your default implementation.
Field Summary | |
---|---|
protected java.util.HashMap |
m_cond
|
protected java.util.List |
m_orderBy
|
Constructor Summary | |
---|---|
Condition()
Default Constructor |
|
Condition(java.lang.String orderBy)
Create a new Condition. |
|
Condition(java.lang.String field,
java.lang.Object value)
Create new Condition |
|
Condition(java.lang.String field,
java.lang.Object value,
java.lang.String orderBy)
Creates new Condition initialized with both an condition and a sort order. |
Method Summary | |
---|---|
void |
addCondition(java.lang.String field,
int value)
Adds a single statement to a condition of type identifier equals value |
void |
addCondition(java.lang.String field,
long value)
Adds a single statement to a condition of type identifier equals value |
void |
addCondition(java.lang.String field,
java.lang.Object value)
Adds a single statement to a condition of type identifier equals value |
void |
addOrderBy(java.lang.String field)
Adds a sort order to the condition. |
void |
clearOrderBy()
removes previously set sort order. |
boolean |
equals(java.lang.Object o)
|
abstract java.lang.Object |
getCondition()
abstract function left to specific datasource implementation to actually use condition and order by in a way the implementation does understand |
java.util.Map |
getConditions()
get the statements added by the addCondition in a hashtable |
java.util.List |
getOrderBy()
get list of order by statements |
void |
removeCondition(java.lang.String field)
removes the statement that was set for this identifier |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.List m_orderBy
protected java.util.HashMap m_cond
Constructor Detail |
---|
public Condition()
public Condition(java.lang.String orderBy)
orderBy
- String the identifier you want to order the data bypublic Condition(java.lang.String field, java.lang.Object value)
field
- String, the field identifiervalue
- Object, value to look foraddCondition(String,Object)
public Condition(java.lang.String field, java.lang.Object value, java.lang.String orderBy)
Kind of superflues, but it is here
field
- String, te identifiervalue
- Object, the value to look fororderBy
- String, identifier to sort byMethod Detail |
---|
public void addCondition(java.lang.String field, java.lang.Object value)
identifier equals value
Storage type assures you can only have one condition per identifier. In case a field is set multiple times the last value will be used in the condition
field
- String, the identifiervalue
- Object, the value
java.lang.NullPointerException
- if value or field are emptypublic void addCondition(java.lang.String field, int value)
identifier equals value
field
- String, the identifiervalue
- int, the valueaddCondition(String, Object)
public void addCondition(java.lang.String field, long value)
identifier equals value
field
- String, the identifiervalue
- long, the valueaddCondition(String, Object)
public void removeCondition(java.lang.String field)
field
- public void addOrderBy(java.lang.String field)
The order and sequence of the data will depend on the implementation. Fields are stored in sequence they where added an multiple identifiers can be specified
field
- String, the column identifierpublic void clearOrderBy()
No individual identifiers can be removed. Only all values. You can then define a new set of order conditions.
public java.util.List getOrderBy()
Not happy with this function so expect it to change in future releases
public java.util.Map getConditions()
addCondition
in a hashtable
Not happy with this function so expect it to change in future releases
public abstract java.lang.Object getCondition()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Object.equals(Object)
,
Object.hashCode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |