Interface Mappable<T extends BaseEntity>

  • All Known Implementing Classes:
    BaseMapper

    public interface Mappable<T extends BaseEntity>
    Author:
    Collin Alpert
    • Method Detail

      • map

        Optional<T> map​(ResultSet set,
                        Map<String,​String> aliases)
                 throws SQLException
        Maps a ResultSet to an Optional. Should be used when only one result is expected from the database.
        Parameters:
        set - The ResultSet to get the data from.
        aliases - A map of column aliases needed to retrieve column data from the ResultSet.
        Returns:
        An Optional containing the ResultSets data.
        Throws:
        SQLException - In case the ResultSet can't be read.
      • mapToList

        List<T> mapToList​(ResultSet set,
                          Map<String,​String> aliases)
                   throws SQLException
        Maps a ResultSet to a List.
        Parameters:
        set - The ResultSet to get the data from.
        aliases - A map of column aliases needed to retrieve column data from the ResultSet.
        Returns:
        A List containing the ResultSets data.
        Throws:
        SQLException - In case the ResultSet can't be read.
      • mapToStream

        Stream<T> mapToStream​(ResultSet set,
                              Map<String,​String> aliases)
                       throws SQLException
        Maps a ResultSet to a Stream.
        Parameters:
        set - The ResultSet to get the data from.
        aliases - A map of column aliases needed to retrieve column data from the ResultSet.
        Returns:
        A Stream containing the ResultSets data.
        Throws:
        SQLException - In case the ResultSet can't be read.
      • mapToArray

        T[] mapToArray​(ResultSet set,
                       Map<String,​String> aliases)
                throws SQLException
        Maps a ResultSet to an array.
        Parameters:
        set - The ResultSet to get the data from.
        aliases - A map of column aliases needed to retrieve column data from the ResultSet.
        Returns:
        An array containing the ResultSets data.
        Throws:
        SQLException - In case the ResultSet can'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 a ResultSet to a Map.
        Type Parameters:
        K - The type of the keys in the map.
        V - The type of the values in the map.
        Parameters:
        set - The ResultSet to 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 the ResultSet.
        Returns:
        A Map containing the ResultSets data.
        Throws:
        SQLException - In case the ResultSet can't be read.