ehcache

net.sf.ehcache.search.impl
Class ResultsImpl

java.lang.Object
  extended by net.sf.ehcache.search.impl.ResultsImpl
All Implemented Interfaces:
Results

public class ResultsImpl
extends Object
implements Results

Results implementation

Author:
teck

Constructor Summary
ResultsImpl(List<? extends Result> results, boolean hasKeys, boolean hasValues, boolean hasAttributes, boolean hasAggregators)
          Constructor
ResultsImpl(List<? extends Result> results, boolean hasKeys, boolean hasValues, boolean hasAttributes, boolean hasAggregators, Runnable discardCallback)
          Constructor
 
Method Summary
 List<Result> all()
          List containing all of the search results.
 void discard()
          Discard this query result.
 boolean hasAggregators()
          Whether the results contains aggregates
 boolean hasAttributes()
          Whether the Results have cache attributes included.
 boolean hasKeys()
          Whether the Results have cache keys included.
 boolean hasValues()
          Whether the Results have cache values included.
 List<Result> range(int start, int length)
          Retrieve a subset of the cache results.
 int size()
          Results size
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResultsImpl

public ResultsImpl(List<? extends Result> results,
                   boolean hasKeys,
                   boolean hasValues,
                   boolean hasAttributes,
                   boolean hasAggregators)
Constructor

Parameters:
results -
hasKeys -
hasAttributes -
hasAggregators -

ResultsImpl

public ResultsImpl(List<? extends Result> results,
                   boolean hasKeys,
                   boolean hasValues,
                   boolean hasAttributes,
                   boolean hasAggregators,
                   Runnable discardCallback)
Constructor

Parameters:
results -
hasKeys -
hasAttributes -
hasAggregators -
Method Detail

toString

public String toString()
Overrides:
toString in class Object

discard

public void discard()
Discard this query result. This call is not mandatory but is recommended after the caller is done with results. It can allow the cache, which may be distributed, to immediately free any resources associated with this result.

Multiple calls are ignored. Attempting to read results from this instance after this method has been called will produce SearchException

Specified by:
discard in interface Results

all

public List<Result> all()
                 throws SearchException
List containing all of the search results.

Specified by:
all in interface Results
Returns:
a List of all the matching cache entries
Throws:
SearchException

range

public List<Result> range(int start,
                          int length)
                   throws SearchException
Retrieve a subset of the cache results. This method is useful when showing "paged" results in a user interface.

Specified by:
range in interface Results
Parameters:
start - starting index to access
length - the number of results to return
Returns:
a List of the given size. This list will be smaller than the requested size if no more results are available. If there are no more results an empty list will be returned.
Throws:
SearchException

size

public int size()
Results size

Specified by:
size in interface Results
Returns:
number of results present

hasKeys

public boolean hasKeys()
Whether the Results have cache keys included. If so these can be extracted from the Result object.

Specified by:
hasKeys in interface Results
Returns:
true if keys are included

hasValues

public boolean hasValues()
Whether the Results have cache values included. If so these can be extracted from the Result object.

Specified by:
hasValues in interface Results
Returns:
true if values are included

hasAttributes

public boolean hasAttributes()
Whether the Results have cache attributes included. If so these can be extracted from the Result object.

Specified by:
hasAttributes in interface Results
Returns:
true if attributes are included

hasAggregators

public boolean hasAggregators()
Whether the results contains aggregates

Specified by:
hasAggregators in interface Results
Returns:
true if this is an aggregate

ehcache

Copyright 2001-2017, Terracotta, Inc.