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
      java.util.Optional<T> map​(java.sql.ResultSet set)
      Maps a ResultSet to an Optional.
      T[] mapToArray​(java.sql.ResultSet set)
      Maps a ResultSet to an array.
      java.util.List<T> mapToList​(java.sql.ResultSet set)
      Maps a ResultSet to a List.
      java.util.stream.Stream<T> mapToStream​(java.sql.ResultSet set)
      Maps a ResultSet to a Stream.
    • Method Detail

      • map

        java.util.Optional<T> map​(java.sql.ResultSet set)
                           throws java.sql.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.
        Returns:
        An Optional containing the ResultSets data.
        Throws:
        java.sql.SQLException - In case the ResultSet can't be read.
      • mapToList

        java.util.List<T> mapToList​(java.sql.ResultSet set)
                             throws java.sql.SQLException
        Maps a ResultSet to a List.
        Parameters:
        set - The ResultSet to get the data from.
        Returns:
        An Optional containing the ResultSets data.
        Throws:
        java.sql.SQLException - In case the ResultSet can't be read.
      • mapToStream

        java.util.stream.Stream<T> mapToStream​(java.sql.ResultSet set)
                                        throws java.sql.SQLException
        Maps a ResultSet to a Stream.
        Parameters:
        set - The ResultSet to get the data from.
        Returns:
        An Optional containing the ResultSets data.
        Throws:
        java.sql.SQLException - In case the ResultSet can't be read.
      • mapToArray

        T[] mapToArray​(java.sql.ResultSet set)
                throws java.sql.SQLException
        Maps a ResultSet to an array.
        Parameters:
        set - The ResultSet to get the data from.
        Returns:
        An Optional containing the ResultSets data.
        Throws:
        java.sql.SQLException - In case the ResultSet can't be read.