Package org.infinispan.query.dsl
Interface Query<T>
-
- All Superinterfaces:
Iterable<T>,PaginationContext<Query<T>>,ParameterContext<Query<T>>
public interface Query<T> extends Iterable<T>, PaginationContext<Query<T>>, ParameterContext<Query<T>>
An immutable object representing both the query and the result. The result is obtained lazily when one of the methods in this interface is executed first time. The query is executed only once. Further calls will just return the previously cached results. If you intend to re-execute the query to obtain fresh data you need to build another instance using aQueryBuilder.- Since:
- 6.0
- Author:
- anistor@redhat.com
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description QueryResult<T>execute()Executes the query.intgetMaxResults()Map<String,Object>getParameters()Returns the named parameters Map.String[]getProjection()StringgetQueryString()Returns the Ickle query string.intgetResultSize()Deprecated.since 10.1.longgetStartOffset()CloseableIterator<T>iterator()List<T>list()Deprecated.since 11.0, useQueryResult.list()instead.Query<T>maxResults(int maxResults)Query<T>setParameter(String paramName, Object paramValue)Sets the value of a named parameter.Query<T>setParameters(Map<String,Object> paramValues)Sets multiple named parameters at once.Query<T>startOffset(long startOffset)
-
-
-
Method Detail
-
getQueryString
String getQueryString()
Returns the Ickle query string.
-
list
@Deprecated List<T> list()
Deprecated.since 11.0, useQueryResult.list()instead.Returns the results of a search as a list.- Returns:
- list of objects that were found from the search.
-
execute
QueryResult<T> execute()
Executes the query. Subsequent invocations cause the query to be re-executed.- Returns:
QueryResultwith the results.- Since:
- 11.0
-
getResultSize
@Deprecated int getResultSize()
Deprecated.since 10.1. This will be removed with no direct replacement.Gets the total number of results matching the query, ignoring pagination (firstResult, maxResult).- Returns:
- total number of results.
-
getProjection
String[] getProjection()
- Returns:
- the values for query projections or
nullif the query does not have projections.
-
getStartOffset
long getStartOffset()
-
startOffset
Query<T> startOffset(long startOffset)
- Specified by:
startOffsetin interfacePaginationContext<T>
-
getMaxResults
int getMaxResults()
-
maxResults
Query<T> maxResults(int maxResults)
- Specified by:
maxResultsin interfacePaginationContext<T>
-
getParameters
Map<String,Object> getParameters()
Returns the named parameters Map.- Specified by:
getParametersin interfaceParameterContext<T>- Returns:
- the named parameters (unmodifiable) or
nullif the query does not have parameters
-
setParameter
Query<T> setParameter(String paramName, Object paramValue)
Sets the value of a named parameter.- Specified by:
setParameterin interfaceParameterContext<T>- Parameters:
paramName- the parameters name (non-empty and not null)paramValue- a non-null value- Returns:
- itself
-
setParameters
Query<T> setParameters(Map<String,Object> paramValues)
Sets multiple named parameters at once. Parameters names cannot be empty ornull. Parameter values must not benull.- Specified by:
setParametersin interfaceParameterContext<T>- Parameters:
paramValues- a Map of parameters- Returns:
- itself
-
iterator
CloseableIterator<T> iterator()
- Returns:
- the results of the query as an iterator.
-
-