org.kuali.rice.core.api.criteria
Class QueryByCriteria.Builder

java.lang.Object
  extended by org.kuali.rice.core.api.criteria.QueryByCriteria.Builder
All Implemented Interfaces:
Serializable, ModelBuilder
Enclosing class:
QueryByCriteria

public static final class QueryByCriteria.Builder
extends Object
implements ModelBuilder, Serializable

See Also:
Serialized Form

Method Summary
static QueryByCriteria.Builder andAttributes(Map<String,?> attributes)
          Static helper for generating a QueryByCriteria from a Map of attributes by "AND"-ing those attributes together.
static QueryByCriteria.Builder andAttributes(Object object, Collection<String> attributes)
          Static helper for generating a QueryByCriteria that selects the attribute values that exist on the example object.
 QueryByCriteria build()
          Returns an instance of the object being built by this builder based on the current state of the builder.
static QueryByCriteria.Builder create()
           
static QueryByCriteria.Builder create(QueryByCriteria queryByCriteria)
           
static QueryByCriteria.Builder forAttribute(String name, Object value)
          Static helper for generating a QueryByCriteria from a single attribute key/value pair
static QueryByCriteria fromPredicates(Collection<Predicate> predicates)
          convenience method to create an immutable criteria from one or more predicates.
static QueryByCriteria fromPredicates(Predicate... predicates)
          convenience method to create an immutable criteria from one or more predicates.
 CountFlag getCountFlag()
           
 Integer getMaxResults()
           
 List<OrderByField> getOrderByFields()
           
 Predicate[] getPredicates()
          will return an array of the predicates.
 Integer getStartAtIndex()
           
static QueryByCriteria.Builder orAttributes(Map<String,?> attributes)
          Static helper for generating a QueryByCriteria from a Map of attributes by "OR"-ing those attributes together.
static QueryByCriteria.Builder orAttributes(Object object, Collection<String> attributes)
          Static helper for generating a QueryByCriteria that selects the attribute values that exist on the example object.
 QueryByCriteria.Builder setCountFlag(CountFlag countFlag)
           
 void setMaxResults(Integer maxResults)
           
 QueryByCriteria.Builder setOrderByAscending(String... orderByFields)
           
 QueryByCriteria.Builder setOrderByFields(List<OrderByField> orderByFields)
           
 QueryByCriteria.Builder setOrderByFields(OrderByField... orderByFields)
           
 QueryByCriteria.Builder setPredicates(Predicate... predicates)
          Sets the predicates.
 void setStartAtIndex(Integer startAtIndex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static QueryByCriteria.Builder create()

create

public static QueryByCriteria.Builder create(QueryByCriteria queryByCriteria)

getStartAtIndex

public Integer getStartAtIndex()

setStartAtIndex

public void setStartAtIndex(Integer startAtIndex)

getMaxResults

public Integer getMaxResults()

setMaxResults

public void setMaxResults(Integer maxResults)

getCountFlag

public CountFlag getCountFlag()

setCountFlag

public QueryByCriteria.Builder setCountFlag(CountFlag countFlag)

getOrderByFields

public List<OrderByField> getOrderByFields()

setOrderByFields

public QueryByCriteria.Builder setOrderByFields(List<OrderByField> orderByFields)

setOrderByFields

public QueryByCriteria.Builder setOrderByFields(OrderByField... orderByFields)

setOrderByAscending

public QueryByCriteria.Builder setOrderByAscending(String... orderByFields)

getPredicates

public Predicate[] getPredicates()
will return an array of the predicates. may return null if no predicates were set.

Returns:
the predicates

setPredicates

public QueryByCriteria.Builder setPredicates(Predicate... predicates)
Sets the predicates. If multiple predicates are specified then they are wrapped in an "and" predicate. If a null predicate is specified then there will be no constraints on the query.

Parameters:
predicates - the predicates to set.

build

public QueryByCriteria build()
Description copied from interface: ModelBuilder
Returns an instance of the object being built by this builder based on the current state of the builder. It should be possible to invoke this method more than once on the same builder. It should never return null;

Specified by:
build in interface ModelBuilder
Returns:
an instance of the object being built by this builder, should never return null

fromPredicates

public static QueryByCriteria fromPredicates(Predicate... predicates)
convenience method to create an immutable criteria from one or more predicates.


fromPredicates

public static QueryByCriteria fromPredicates(Collection<Predicate> predicates)
convenience method to create an immutable criteria from one or more predicates.


orAttributes

public static QueryByCriteria.Builder orAttributes(Map<String,?> attributes)
Static helper for generating a QueryByCriteria from a Map of attributes by "OR"-ing those attributes together.

Parameters:
attributes - key/value map of attributes to OR together in the criteria
Returns:
a QueryByCriteria which selects the given attributes (if map is non-null and non-empty)

andAttributes

public static QueryByCriteria.Builder andAttributes(Map<String,?> attributes)
Static helper for generating a QueryByCriteria from a Map of attributes by "AND"-ing those attributes together. If any of the values in the Map is a collection, all items in the collection will be "OR"-ed together (essentially treated like an "IN" condition).

Parameters:
attributes - key/value map of attributes to AND together in the criteria
Returns:
a QueryByCriteria which selects the given attributes (if map is non-null and non-empty)

forAttribute

public static QueryByCriteria.Builder forAttribute(String name,
                                                   Object value)
Static helper for generating a QueryByCriteria from a single attribute key/value pair

Parameters:
name - attribute name
value - attribute value
Returns:
a QueryByCriteria which selects the specified attribute value

orAttributes

public static QueryByCriteria.Builder orAttributes(Object object,
                                                   Collection<String> attributes)
Static helper for generating a QueryByCriteria that selects the attribute values that exist on the example object.

Parameters:
object - the example object
attributes - list of attributes to select from the example object
Returns:
a QueryByCriteria that selects the attribute values that exist on the example object

andAttributes

public static QueryByCriteria.Builder andAttributes(Object object,
                                                    Collection<String> attributes)
Static helper for generating a QueryByCriteria that selects the attribute values that exist on the example object.

Parameters:
object - the example object
attributes - list of attributes to select from the example object
Returns:
a QueryByCriteria that selects the attribute values that exist on the example object


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.