Interface DbRow


  • public interface DbRow
    Representation of a single row in a database (in SQL this would be a row, in a Document DB, this would be a single document).
    • Method Detail

      • column

        DbColumn column​(String name)
        Get a column in this row. Column is identified by its name.
        Parameters:
        name - column name
        Returns:
        a column in this row
      • column

        DbColumn column​(int index)
        Get a column in this row. Column is identified by its index.
        Parameters:
        index - column index starting from 1
        Returns:
        a column in this row
      • forEach

        void forEach​(Consumer<? super DbColumn> columnAction)
        Iterate through each column in this row.
        Parameters:
        columnAction - what to do with each column
      • as

        <T> T as​(Class<T> type)
          throws MapperException
        Get specific class instance representation of this row. Mapper for target class must be already registered.
        Type Parameters:
        T - type of the returned value
        Parameters:
        type - class of the returned value type
        Returns:
        instance of requested class containing this database row
        Throws:
        MapperException - in case the mapping is not defined or fails
      • as

        <T> T as​(GenericType<T> type)
          throws MapperException
        Map this row to an object using a DbMapper.
        Type Parameters:
        T - type to be returned
        Parameters:
        type - type that supports generic declarations
        Returns:
        typed row
        Throws:
        MapperException - in case the mapping is not defined or fails
        MapperException - in case the mapping is not defined or fails
      • as

        <T> T as​(Function<DbRow,​T> mapper)
        Get specific class instance representation of this row. Mapper for target class is provided as an argument.
        Type Parameters:
        T - type of the returned value
        Parameters:
        mapper - method to create an target class instance from DbRow
        Returns:
        instance of requested class containing this database row