Package org.infinispan.query.dsl
Interface Query
-
- All Superinterfaces:
PaginationContext<Query>
,ParameterContext<Query>
public interface Query extends PaginationContext<Query>, ParameterContext<Query>
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 int
getMaxResults()
Map<String,Object>
getParameters()
Returns the named parameters Map.String[]
getProjection()
String
getQueryString()
Returns the Ickle query string.int
getResultSize()
Deprecated.since 10.1.long
getStartOffset()
<T> List<T>
list()
Returns the results of a search as a list.Query
maxResults(int maxResults)
Query
setParameter(String paramName, Object paramValue)
Sets the value of a named parameter.Query
setParameters(Map<String,Object> paramValues)
Sets multiple named parameters at once.Query
startOffset(long startOffset)
-
-
-
Method Detail
-
getQueryString
String getQueryString()
Returns the Ickle query string.
-
list
<T> List<T> list()
Returns the results of a search as a list.- Returns:
- list of objects that were found from the search.
-
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
null
if the query does not have projections.
-
getStartOffset
long getStartOffset()
-
startOffset
Query startOffset(long startOffset)
- Specified by:
startOffset
in interfacePaginationContext<Query>
-
getMaxResults
int getMaxResults()
-
maxResults
Query maxResults(int maxResults)
- Specified by:
maxResults
in interfacePaginationContext<Query>
-
getParameters
Map<String,Object> getParameters()
Returns the named parameters Map.- Specified by:
getParameters
in interfaceParameterContext<Query>
- Returns:
- the named parameters (unmodifiable) or
null
if the query does not have parameters
-
setParameter
Query setParameter(String paramName, Object paramValue)
Sets the value of a named parameter.- Specified by:
setParameter
in interfaceParameterContext<Query>
- Parameters:
paramName
- the parameters name (non-empty and not null)paramValue
- a non-null value- Returns:
- itself
-
setParameters
Query setParameters(Map<String,Object> paramValues)
Sets multiple named parameters at once. Parameters names cannot be empty ornull
. Parameter values must not benull
.- Specified by:
setParameters
in interfaceParameterContext<Query>
- Parameters:
paramValues
- a Map of parameters- Returns:
- itself
-
-