Package net.sf.ehcache.search.impl
Class ResultsImpl
- java.lang.Object
-
- net.sf.ehcache.search.impl.ResultsImpl
-
-
Constructor Summary
Constructors Constructor Description ResultsImpl(java.util.List<? extends Result> results, boolean hasKeys, boolean hasValues, boolean hasAttributes, boolean hasAggregators)ConstructorResultsImpl(java.util.List<? extends Result> results, boolean hasKeys, boolean hasValues, boolean hasAttributes, boolean hasAggregators, java.lang.Runnable discardCallback)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Result>all()List containing all of the search results.voiddiscard()Discard this query result.booleanhasAggregators()Whether the results contains aggregatesbooleanhasAttributes()Whether the Results have cache attributes included.booleanhasKeys()Whether the Results have cache keys included.booleanhasValues()Whether the Results have cache values included.java.util.List<Result>range(int start, int length)Retrieve a subset of the cache results.intsize()Results sizejava.lang.StringtoString()
-
-
-
Constructor Detail
-
ResultsImpl
public ResultsImpl(java.util.List<? extends Result> results, boolean hasKeys, boolean hasValues, boolean hasAttributes, boolean hasAggregators)
Constructor- Parameters:
results-hasKeys-hasAttributes-hasAggregators-
-
ResultsImpl
public ResultsImpl(java.util.List<? extends Result> results, boolean hasKeys, boolean hasValues, boolean hasAttributes, boolean hasAggregators, java.lang.Runnable discardCallback)
Constructor- Parameters:
results-hasKeys-hasAttributes-hasAggregators-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.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
-
all
public java.util.List<Result> all() throws SearchException
List containing all of the search results.- Specified by:
allin interfaceResults- Returns:
- a List of all the matching cache entries
- Throws:
SearchException
-
range
public java.util.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:
rangein interfaceResults- Parameters:
start- starting index to accesslength- 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
-
hasKeys
public boolean hasKeys()
Whether the Results have cache keys included. If so these can be extracted from the Result object.
-
hasValues
public boolean hasValues()
Whether the Results have cache values included. If so these can be extracted from the Result object.
-
hasAttributes
public boolean hasAttributes()
Whether the Results have cache attributes included. If so these can be extracted from the Result object.- Specified by:
hasAttributesin interfaceResults- Returns:
- true if attributes are included
-
hasAggregators
public boolean hasAggregators()
Whether the results contains aggregates- Specified by:
hasAggregatorsin interfaceResults- Returns:
- true if this is an aggregate
-
-