Apache CXF API

org.apache.cxf.jaxrs.ext.search
Interface SearchCondition<T>

Type Parameters:
T - Type of the object which will be checked by SearchCondition instance
All Known Implementing Classes:
AbstractComplexCondition, AndSearchCondition, OrSearchCondition, PrimitiveSearchCondition, SimpleSearchCondition

public interface SearchCondition<T>

Can be used to build plain or complex/composite search conditions.

Google Collections Predicate might've been used instead, but it is a too generic and its apply method is not quite needed here


Method Summary
 void accept(SearchConditionVisitor<T> visitor)
          Provides a visitor which will convert this SearchCondition into a custom expression, for example, into the SQL statement, etc
 List<T> findAll(Collection<T> pojos)
          Returns a list of pojos matching the condition
 T getCondition()
          Some SearchConditions may use instance of T to capture the actual search criteria thus making it simpler to implement isMet(T).
 ConditionType getConditionType()
          Returns the type of the condition this SearchCondition represents
 List<SearchCondition<T>> getSearchConditions()
          List of conditions this SearchCondition may represent.
 PrimitiveStatement getStatement()
          Primitive statement such a > b, i < 5, etc this condition may represent.
 boolean isMet(T pojo)
          Checks if the given pojo instance meets this search condition
 

Method Detail

isMet

boolean isMet(T pojo)
Checks if the given pojo instance meets this search condition

Parameters:
pojo - the object which will be checked
Returns:
true if the pojo meets this search condition, false - otherwise

findAll

List<T> findAll(Collection<T> pojos)
Returns a list of pojos matching the condition

Parameters:
pojos - list of pojos
Returns:
list of the matching pojos or null if none have been found

getCondition

T getCondition()
Some SearchConditions may use instance of T to capture the actual search criteria thus making it simpler to implement isMet(T). In some cases, the code which is given SearchCondition may find it more efficient to directly deal with the captured state for a more efficient lookup of matching data/records as opposed to calling SearchCondition.isMet for every instance of T it knows about.

Returns:
T the captured search criteria, can be null

getStatement

PrimitiveStatement getStatement()
Primitive statement such a > b, i < 5, etc this condition may represent. Complex conditions will return null.

Returns:
primitive search statement, can be null

getSearchConditions

List<SearchCondition<T>> getSearchConditions()
List of conditions this SearchCondition may represent. Composite SearchConditions will return a list of conditions they are composed from, primitive ones will return null

Returns:
list of conditions, can be null

getConditionType

ConditionType getConditionType()
Returns the type of the condition this SearchCondition represents

Returns:
condition type

accept

void accept(SearchConditionVisitor<T> visitor)
Provides a visitor which will convert this SearchCondition into a custom expression, for example, into the SQL statement, etc

Parameters:
visitor -

Apache CXF API

Apache CXF