Interface Queryable<T>
-
- All Superinterfaces:
SingleQueryable<T>
- All Known Subinterfaces:
AsyncQueryable<T>
- All Known Implementing Classes:
AsyncEntityProjectionQuery,AsyncEntityQuery,EntityProjectionQuery,EntityQuery
public interface Queryable<T> extends SingleQueryable<T>
- Author:
- Collin Alpert
-
-
Method Summary
Modifier and Type Method Description T[]toArray()Executes a new query and returns the result as an array.List<T>toList()Executes the query and returns the result as aList.<K> Map<K,T>toMap(Function<T,K> keyMapping)Executes a new query and returns the result as aMap.<K,V>
Map<K,V>toMap(Function<T,K> keyMapping, Function<T,V> valueMapping)Executes a new query and returns the result as aMap.Stream<T>toStream()Executes the query and returns the result as aStream.-
Methods inherited from interface com.github.collinalpert.java2db.queries.SingleQueryable
first, getQuery
-
-
-
-
Method Detail
-
toList
List<T> toList()
Executes the query and returns the result as aList.- Returns:
- A list of entities representing the result rows.
-
toStream
Stream<T> toStream()
Executes the query and returns the result as aStream.- Returns:
- A list of entities representing the result rows.
-
toArray
T[] toArray()
Executes a new query and returns the result as an array.- Returns:
- An array of entities representing the result rows.
-
toMap
<K> Map<K,T> toMap(Function<T,K> keyMapping)
Executes a new query and returns the result as aMap. This method is equivalent to the callQueryable#toMap(keyMapping, x -> x).- 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
<K,V> Map<K,V> toMap(Function<T,K> keyMapping, Function<T,V> valueMapping)
Executes a new query and returns the result as aMap.- 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.
-
-