Class ColumnOutcome<T>

  • Type Parameters:
    T - Type of items
    All Implemented Interfaces:
    Outcome<Collection<T>>

    public final class ColumnOutcome<T>
    extends Object
    implements Outcome<Collection<T>>
    Outcome that returns first column.

    Use it when you need the first column:

     Collection&lgt;Long> salaries = new JdbcSession(source)
       .sql("SELECT salary FROM user")
       .select(new ColumnOutcome<Long>(Long.class));

    Supported types are: String, Long, Boolean, Byte, Date, UUID, and Utc.

    Since:
    0.13
    • Constructor Detail

      • ColumnOutcome

        public ColumnOutcome​(Class<T> tpe)
        Public ctor.
        Parameters:
        tpe - The type to convert to
      • ColumnOutcome

        public ColumnOutcome​(Class<T> tpe,
                             Outcome.Mappings mps)
        Public ctor.
        Parameters:
        tpe - The type to convert to
        mps - The mappings.
    • Method Detail

      • handle

        public Collection<T> handle​(ResultSet rset,
                                    Statement stmt)
                             throws SQLException
        Description copied from interface: Outcome
        Process the result set and return some value.
        Specified by:
        handle in interface Outcome<T>
        Parameters:
        rset - The result set to process
        stmt - The statement used in the run
        Returns:
        The result
        Throws:
        SQLException - If something goes wrong inside