Interface Mappable<T extends BaseEntity>
-
- All Known Implementing Classes:
BaseMapper
public interface Mappable<T extends BaseEntity>- Author:
- Collin Alpert
-
-
Method Summary
Modifier and Type Method Description Optional<T>map(ResultSet set, Map<String,String> aliases)Maps aResultSetto anOptional.T[]mapToArray(ResultSet set, Map<String,String> aliases)Maps aResultSetto an array.List<T>mapToList(ResultSet set, Map<String,String> aliases)Maps aResultSetto aList.<K,V>
Map<K,V>mapToMap(ResultSet set, Function<T,K> keyMapping, Function<T,V> valueMapping, Map<String,String> aliases)Maps aResultSetto aMap.Stream<T>mapToStream(ResultSet set, Map<String,String> aliases)Maps aResultSetto aStream.
-
-
-
Method Detail
-
map
Optional<T> map(ResultSet set, Map<String,String> aliases) throws SQLException
Maps aResultSetto anOptional. Should be used when only one result is expected from the database.- Parameters:
set- TheResultSetto get the data from.aliases- A map of column aliases needed to retrieve column data from theResultSet.- Returns:
- An
Optionalcontaining theResultSets data. - Throws:
SQLException- In case theResultSetcan't be read.
-
mapToList
List<T> mapToList(ResultSet set, Map<String,String> aliases) throws SQLException
Maps aResultSetto aList.- Parameters:
set- TheResultSetto get the data from.aliases- A map of column aliases needed to retrieve column data from theResultSet.- Returns:
- A
Listcontaining theResultSets data. - Throws:
SQLException- In case theResultSetcan't be read.
-
mapToStream
Stream<T> mapToStream(ResultSet set, Map<String,String> aliases) throws SQLException
Maps aResultSetto aStream.- Parameters:
set- TheResultSetto get the data from.aliases- A map of column aliases needed to retrieve column data from theResultSet.- Returns:
- A
Streamcontaining theResultSets data. - Throws:
SQLException- In case theResultSetcan't be read.
-
mapToArray
T[] mapToArray(ResultSet set, Map<String,String> aliases) throws SQLException
Maps aResultSetto an array.- Parameters:
set- TheResultSetto get the data from.aliases- A map of column aliases needed to retrieve column data from theResultSet.- Returns:
- An array containing the
ResultSets data. - Throws:
SQLException- In case theResultSetcan't be read.
-
mapToMap
<K,V> Map<K,V> mapToMap(ResultSet set, Function<T,K> keyMapping, Function<T,V> valueMapping, Map<String,String> aliases) throws SQLException
Maps aResultSetto aMap.- Type Parameters:
K- The type of the keys in the map.V- The type of the values in the map.- Parameters:
set- TheResultSetto get the data from.keyMapping- The key function of the map.valueMapping- The value function of the map.aliases- A map of column aliases needed to retrieve column data from theResultSet.- Returns:
- A
Mapcontaining theResultSets data. - Throws:
SQLException- In case theResultSetcan't be read.
-
-