Class BaseMapper<E extends BaseEntity>

  • All Implemented Interfaces:
    Mappable<E>

    public class BaseMapper<E extends BaseEntity>
    extends Object
    implements Mappable<E>
    Default mapper for converting a ResultSet to the respective Java entity.
    Author:
    Collin Alpert
    • Constructor Detail

      • BaseMapper

        public BaseMapper​(Class<E> clazz)
    • Method Detail

      • mapToMap

        public <K,​V> Map<K,​V> mapToMap​(ResultSet set,
                                                   Function<E,​K> keyMapping,
                                                   Function<E,​V> valueMapping,
                                                   Map<String,​String> aliases)
                                            throws SQLException
        Maps a ResultSet to a Map.
        Specified by:
        mapToMap in interface Mappable<E extends BaseEntity>
        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.