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()intgetPage()intbooleanbooleanname()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.voidsetAttribute(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, waitMethods inherited from interface com.codingchili.core.storage.QueryBuilder
and, between, equalTo, execute, in, like, matches, or, startsWith
-
Method Details
-
poll
Description copied from interface:QueryBuilderExecutes the query periodically.- Specified by:
pollin interfaceQueryBuilder<Value extends Storable>- Parameters:
consumer- a consumer that receives the resultstimer- the source of the interval.- Returns:
- fluent.
-
on
Description copied from interface:QueryBuilderThe attribute to be queried.- Specified by:
onin interfaceQueryBuilder<Value extends Storable>- Parameters:
attribute- the name of the queried attribute.- Returns:
- fluent
-
page
Description copied from interface:QueryBuilderset the page offset for paging support.- Specified by:
pagein interfaceQueryBuilder<Value extends Storable>- Parameters:
page- the page to return results from.- Returns:
- fluent
-
pageSize
Description copied from interface:QueryBuilderset the size of each page for paging support.- Specified by:
pageSizein interfaceQueryBuilder<Value extends Storable>- Parameters:
pageSize- the number of hits returned on each page.- Returns:
- fluent
-
orderBy
Description copied from interface:QueryBuilderOrders the result by the given attribute using the default sort order unless the sort order has been explicitly set.- Specified by:
orderByin 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:QueryBuilderOrders the result by the given direction using the last specified attribute handler unless orderBy is set.- Specified by:
orderin interfaceQueryBuilder<Value extends Storable>- Parameters:
order- descending or ascending.- Returns:
- fluent
-
name
Description copied from interface:QueryBuilderGenerates unique ids for the triggers that are used. Should be overridden so that logging messages are a bit meaningful.- Specified by:
namein interfaceQueryBuilder<Value extends Storable>- Returns:
- a name that identifies this query.
-
setName
Description copied from interface:QueryBuilderSets a name for the query for identification.- Specified by:
setNamein 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
-