Package com.codingchili.core.storage
Class AbstractQueryBuilder<Value extends Storable>
java.lang.Object
com.codingchili.core.storage.AbstractQueryBuilder<Value>
- All Implemented Interfaces:
QueryBuilder<Value>
- Direct Known Subclasses:
IndexedMapQuery
public abstract class AbstractQueryBuilder<Value extends Storable>
extends Object
implements QueryBuilder<Value>
Base class for the query builder.
Removes any array notations formatted as CoreStrings.STORAGE_ARRAY
If an arrayNotation is supplied in the constructor, it will instead be replaced
with the specified notation.
-
Method Summary
Modifier and TypeMethodDescriptiongetName()
int
getPage()
int
boolean
boolean
name()
Generates unique ids for the triggers that are used.The attribute to be queried.Orders the result by the given direction using the last specified attribute handler unless orderBy is set.Orders the result by the given attribute using the default sort order unless the sort order has been explicitly set.page(int page)
set the page offset for paging support.pageSize(int pageSize)
set the size of each page for paging support.poll(Consumer<Collection<Value>> consumer, TimerSource timer)
Executes the query periodically.void
setAttribute(String attribute)
Sets a name for the query for identification.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.codingchili.core.storage.QueryBuilder
and, between, equalTo, execute, in, like, matches, or, startsWith
-
Method Details
-
poll
Description copied from interface:QueryBuilder
Executes the query periodically.- Specified by:
poll
in interfaceQueryBuilder<Value extends Storable>
- Parameters:
consumer
- a consumer that receives the resultstimer
- the source of the interval.- Returns:
- fluent.
-
on
Description copied from interface:QueryBuilder
The attribute to be queried.- Specified by:
on
in interfaceQueryBuilder<Value extends Storable>
- Parameters:
attribute
- the name of the queried attribute.- Returns:
- fluent
-
page
Description copied from interface:QueryBuilder
set the page offset for paging support.- Specified by:
page
in interfaceQueryBuilder<Value extends Storable>
- Parameters:
page
- the page to return results from.- Returns:
- fluent
-
pageSize
Description copied from interface:QueryBuilder
set the size of each page for paging support.- Specified by:
pageSize
in interfaceQueryBuilder<Value extends Storable>
- Parameters:
pageSize
- the number of hits returned on each page.- Returns:
- fluent
-
orderBy
Description copied from interface:QueryBuilder
Orders the result by the given attribute using the default sort order unless the sort order has been explicitly set.- Specified by:
orderBy
in interfaceQueryBuilder<Value extends Storable>
- Parameters:
orderByAttribute
- the handler of the attribute to sort by using dot notation.- Returns:
- fluent
-
attribute
-
setAttribute
-
isAttributeArray
public boolean isAttributeArray() -
getOrderByAttribute
-
order
Description copied from interface:QueryBuilder
Orders the result by the given direction using the last specified attribute handler unless orderBy is set.- Specified by:
order
in interfaceQueryBuilder<Value extends Storable>
- Parameters:
order
- descending or ascending.- Returns:
- fluent
-
name
Description copied from interface:QueryBuilder
Generates unique ids for the triggers that are used. Should be overridden so that logging messages are a bit meaningful.- Specified by:
name
in interfaceQueryBuilder<Value extends Storable>
- Returns:
- a name that identifies this query.
-
setName
Description copied from interface:QueryBuilder
Sets a name for the query for identification.- Specified by:
setName
in interfaceQueryBuilder<Value extends Storable>
- Parameters:
name
- the name to set- Returns:
- fluent
-
isOrdered
public boolean isOrdered() -
getSortOrder
-
getPageSize
public int getPageSize() -
getPage
public int getPage() -
getName
-
getArrayNotation
-
getAttribute
-