Package org.infinispan.query.dsl.impl
Class BaseQuery
- java.lang.Object
-
- org.infinispan.query.dsl.impl.BaseQuery
-
- All Implemented Interfaces:
PaginationContext<Query>
,ParameterContext<Query>
,Query
public abstract class BaseQuery extends Object implements Query
- Since:
- 7.2
- Author:
- anistor@redhat.com
-
-
Field Summary
Fields Modifier and Type Field Description protected int
maxResults
protected Map<String,Object>
namedParameters
protected String[]
projection
protected QueryFactory
queryFactory
protected String
queryString
protected int
startOffset
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseQuery(QueryFactory queryFactory, String queryString)
protected
BaseQuery(QueryFactory queryFactory, String queryString, Map<String,Object> namedParameters, String[] projection, long startOffset, int maxResults)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getJPAQuery()
Deprecated.To be removed in Infinispan 10.0.int
getMaxResults()
Map<String,Object>
getNamedParameters()
Deprecated.To be removed in Infinispan 10.0.Map<String,Object>
getParameters()
Returns the named parameters Map.String[]
getProjection()
String
getQueryString()
Returns the Ickle query string.long
getStartOffset()
Query
maxResults(int maxResults)
abstract void
resetQuery()
Reset internal state after pagination or query parameters are modified.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)
void
validateNamedParameters()
Ensure all named parameters have non-null values.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.query.dsl.Query
getResultSize, list
-
-
-
-
Constructor Detail
-
BaseQuery
protected BaseQuery(QueryFactory queryFactory, String queryString, Map<String,Object> namedParameters, String[] projection, long startOffset, int maxResults)
-
BaseQuery
protected BaseQuery(QueryFactory queryFactory, String queryString)
-
-
Method Detail
-
getJPAQuery
@Deprecated public String getJPAQuery()
Deprecated.To be removed in Infinispan 10.0. UsegetQueryString()
instead.Returns the query string.- Returns:
- the query string
-
getQueryString
public String getQueryString()
Returns the Ickle query string.- Specified by:
getQueryString
in interfaceQuery
- Returns:
- the Ickle query string
-
getNamedParameters
@Deprecated public Map<String,Object> getNamedParameters()
Deprecated.To be removed in Infinispan 10.0. UsegetParameters()
instead.Returns the named parameters Map.- Returns:
- the named parameters (unmodifiable) or
null
if the query does not have parameters
-
getParameters
public Map<String,Object> getParameters()
Description copied from interface:ParameterContext
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
public Query setParameter(String paramName, Object paramValue)
Description copied from interface:ParameterContext
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
public Query setParameters(Map<String,Object> paramValues)
Description copied from interface:ParameterContext
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
-
resetQuery
public abstract void resetQuery()
Reset internal state after pagination or query parameters are modified. This is needed to ensure the next execution of the query uses the new values.
-
validateNamedParameters
public void validateNamedParameters()
Ensure all named parameters have non-null values.
-
getProjection
public String[] getProjection()
- Specified by:
getProjection
in interfaceQuery
- Returns:
- the values for query projections or null if the query does not have projections.
-
getStartOffset
public long getStartOffset()
-
getMaxResults
public int getMaxResults()
-
startOffset
public Query startOffset(long startOffset)
- Specified by:
startOffset
in interfacePaginationContext<Query>
-
maxResults
public Query maxResults(int maxResults)
- Specified by:
maxResults
in interfacePaginationContext<Query>
-
-