-
public interface DbRowRepresentation 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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Tas(GenericType<T> type)Map this row to an object using aDbMapper.<T> Tas(Class<T> type)Get specific class instance representation of this row.<T> Tas(Function<DbRow,T> mapper)Get specific class instance representation of this row.DbColumncolumn(int index)Get a column in this row.DbColumncolumn(String name)Get a column in this row.voidforEach(Consumer<? super DbColumn> columnAction)Iterate through each column in this row.
-
-
-
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 from1- 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 aDbMapper.- 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 failsMapperException- 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 fromDbRow- Returns:
- instance of requested class containing this database row
-
-