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 a QueryBuilder.
    Since:
    6.0
    Author:
    anistor@redhat.com
    • 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()
      • getMaxResults

        int getMaxResults()
      • getParameters

        Map<String,​Object> getParameters()
        Returns the named parameters Map.
        Specified by:
        getParameters in interface ParameterContext<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 interface ParameterContext<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 or null. Parameter values must not be null.
        Specified by:
        setParameters in interface ParameterContext<Query>
        Parameters:
        paramValues - a Map of parameters
        Returns:
        itself