public abstract class Condition
extends java.lang.Object
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.
| Modifier and Type | Field and Description |
|---|---|
protected Filter |
m_filter |
protected java.util.List |
m_orderBy |
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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) |
java.util.Map |
getConditions()
Deprecated.
|
Filter |
getFilter()
get the statements added by the
addCondition in a hashtable |
java.util.List<Filter.Equation> |
getFilterByKey(java.lang.String key) |
java.util.List |
getOrderBy()
get list of order by statements
|
int |
hashCode() |
void |
removeCondition(java.lang.String field)
removes the filter Equal that was set for this identifier
|
void |
removeFilter(Filter filter) |
void |
setFilter(Filter f) |
protected java.util.List m_orderBy
protected Filter m_filter
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 bypublic 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 valuepublic void addCondition(java.lang.String field,
int value)
identifier equals valuefield - String, the identifiervalue - int, the valueaddCondition(String, Object)public void addCondition(java.lang.String field,
long value)
identifier equals valuefield - String, the identifiervalue - long, the valueaddCondition(String, Object)public void removeCondition(java.lang.String field)
field - removeFilter(Filter)public void removeFilter(Filter filter)
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 Filter getFilter()
addCondition in a hashtable
Not happy with this function so expect it to change in future releases
public void setFilter(Filter f)
public java.util.List<Filter.Equation> getFilterByKey(java.lang.String key)
public boolean equals(java.lang.Object o)
equals in class java.lang.ObjectObject.equals(Object),
Object.hashCode()public int hashCode()
hashCode in class java.lang.Object