public class EntityQueryBuilder
extends java.lang.Object
Data query builder exposing a fluent interface.
Constructor and Description |
---|
EntityQueryBuilder(EntityType type)
Construct a new data query builder.
|
Modifier and Type | Method and Description |
---|---|
<A> EntityQueryBuilder |
addFilterField(Attribute<?> condition)
Add a filter condition to the builder.
|
<A> EntityQueryBuilder |
addFilterField(TypedName<A> name,
A obj)
Add a filter condition to the builder.
|
EntityQueryBuilder |
addFilterFields(java.util.List<Attribute<?>> conditions)
Add a filter condition to the builder.
|
EntityQueryBuilder |
addSortKey(SortKey key)
Add a sort key.
|
EntityQueryBuilder |
addSortKey(TypedName<? extends java.lang.Comparable> attr)
Add an ascending sort key.
|
EntityQueryBuilder |
addSortKey(TypedName<? extends java.lang.Comparable> name,
SortOrder order)
Add a sort key.
|
EntityQueryBuilder |
addSortKeys(java.lang.Iterable<SortKey> keys)
Add multiple sort keys.
|
EntityQuery<Entity> |
build()
Build the data query.
|
<E extends Entity> |
buildWithView(java.lang.Class<E> viewClass)
Build the data query with a view type.
|
EntityQueryBuilder |
copy()
Create a new entity query builder that is a copy of this one.
|
EntityQueryBuilder |
setEntityType(EntityType type)
Deprecated.
Just provide a type at construction time.
|
public EntityQueryBuilder(EntityType type)
Construct a new data query builder.
type
- The entity type.@Deprecated public EntityQueryBuilder setEntityType(EntityType type)
Set the entity type.
type
- The entity type.public <A> EntityQueryBuilder addFilterField(TypedName<A> name, @Nonnull A obj)
Add a filter condition to the builder.
name
- The attribute to filter.obj
- The object to test for equality.A
- The attribute type.public <A> EntityQueryBuilder addFilterField(Attribute<?> condition)
Add a filter condition to the builder.
condition
- The condition to add.A
- The attribute type.public EntityQueryBuilder addFilterFields(java.util.List<Attribute<?>> conditions)
Add a filter condition to the builder.
conditions
- The conditions to add.public EntityQueryBuilder addSortKey(TypedName<? extends java.lang.Comparable> attr)
Add an ascending sort key.
attr
- The attribute to sort by.public EntityQueryBuilder addSortKey(TypedName<? extends java.lang.Comparable> name, SortOrder order)
Add a sort key.
name
- The attribute to sort by.order
- The sort order.public EntityQueryBuilder addSortKey(SortKey key)
Add a sort key.
key
- The sort key to add.public EntityQueryBuilder addSortKeys(java.lang.Iterable<SortKey> keys)
Add multiple sort keys.
keys
- The sort key to add.public EntityQueryBuilder copy()
Create a new entity query builder that is a copy of this one. Future additions to either will not affect the other.
public EntityQuery<Entity> build()
Build the data query.
public <E extends Entity> EntityQuery<E> buildWithView(java.lang.Class<E> viewClass)
Build the data query with a view type.