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 Details

    • poll

      public EntryWatcher<Value> poll(Consumer<Collection<Value>> consumer, TimerSource timer)
      Description copied from interface: QueryBuilder
      Executes the query periodically.
      Specified by:
      poll in interface QueryBuilder<Value extends Storable>
      Parameters:
      consumer - a consumer that receives the results
      timer - the source of the interval.
      Returns:
      fluent.
    • on

      public QueryBuilder<Value> on(String attribute)
      Description copied from interface: QueryBuilder
      The attribute to be queried.
      Specified by:
      on in interface QueryBuilder<Value extends Storable>
      Parameters:
      attribute - the name of the queried attribute.
      Returns:
      fluent
    • page

      public QueryBuilder<Value> page(int page)
      Description copied from interface: QueryBuilder
      set the page offset for paging support.
      Specified by:
      page in interface QueryBuilder<Value extends Storable>
      Parameters:
      page - the page to return results from.
      Returns:
      fluent
    • pageSize

      public QueryBuilder<Value> pageSize(int pageSize)
      Description copied from interface: QueryBuilder
      set the size of each page for paging support.
      Specified by:
      pageSize in interface QueryBuilder<Value extends Storable>
      Parameters:
      pageSize - the number of hits returned on each page.
      Returns:
      fluent
    • orderBy

      public QueryBuilder<Value> orderBy(String orderByAttribute)
      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 interface QueryBuilder<Value extends Storable>
      Parameters:
      orderByAttribute - the handler of the attribute to sort by using dot notation.
      Returns:
      fluent
    • attribute

      public String attribute()
    • setAttribute

      public void setAttribute(String attribute)
    • isAttributeArray

      public boolean isAttributeArray()
    • getOrderByAttribute

      public String getOrderByAttribute()
    • order

      public QueryBuilder<Value> order(SortOrder 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 interface QueryBuilder<Value extends Storable>
      Parameters:
      order - descending or ascending.
      Returns:
      fluent
    • name

      public String 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 interface QueryBuilder<Value extends Storable>
      Returns:
      a name that identifies this query.
    • setName

      public QueryBuilder<Value> setName(String name)
      Description copied from interface: QueryBuilder
      Sets a name for the query for identification.
      Specified by:
      setName in interface QueryBuilder<Value extends Storable>
      Parameters:
      name - the name to set
      Returns:
      fluent
    • isOrdered

      public boolean isOrdered()
    • getSortOrder

      public SortOrder getSortOrder()
    • getPageSize

      public int getPageSize()
    • getPage

      public int getPage()
    • getName

      public String getName()
    • getArrayNotation

      public String getArrayNotation()
    • getAttribute

      public String getAttribute()