Class EntityProjectionQuery<E extends BaseEntity,​R>

    • Constructor Detail

      • EntityProjectionQuery

        public EntityProjectionQuery​(com.github.collinalpert.lambda2sql.functions.SqlFunction<E,​R> projection,
                                     EntityQuery<E> originalQuery)
    • Method Detail

      • toList

        public List<R> toList()
        Description copied from interface: Queryable
        Executes the query and returns the result as a List.
        Specified by:
        toList in interface Queryable<E extends BaseEntity>
        Returns:
        A list of entities representing the result rows.
      • toStream

        public Stream<R> toStream()
        Description copied from interface: Queryable
        Executes the query and returns the result as a Stream.
        Specified by:
        toStream in interface Queryable<E extends BaseEntity>
        Returns:
        A list of entities representing the result rows.
      • toArray

        public R[] toArray()
        Description copied from interface: Queryable
        Executes a new query and returns the result as an array.
        Specified by:
        toArray in interface Queryable<E extends BaseEntity>
        Returns:
        An array of entities representing the result rows.
      • toMap

        public <K> Map<K,​R> toMap​(Function<R,​K> keyMapping)
        Executes a new query and returns the result as a Map. This method is equivalent to the call Queryable#toMap(keyMapping, x -> x).
        Specified by:
        toMap in interface Queryable<E extends BaseEntity>
        Type Parameters:
        K - The type of the field representing the keys.
        Parameters:
        keyMapping - The field representing the keys of the map.
        Returns:
        A map containing the result of the query.
      • toMap

        public <K,​V> Map<K,​V> toMap​(Function<R,​K> keyMapping,
                                                Function<R,​V> valueMapping)
        Executes a new query and returns the result as a Map.
        Specified by:
        toMap in interface Queryable<E extends BaseEntity>
        Type Parameters:
        K - The type of the field representing the keys.
        V - The type of the field representing the values.
        Parameters:
        keyMapping - The field representing the keys of the map.
        valueMapping - The field representing the values of the map.
        Returns:
        A map containing the result of the query.