- All Known Implementing Classes:
DbRowBase
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 Summary
Modifier and TypeMethodDescription<T> T
as
(GenericType<T> type) Map this row to an object using aDbMapper
.<T> T
Get specific class instance representation of this row.<T> T
Get specific class instance representation of this row.column
(int index) Get a column in this row.Get a column in this row.void
Iterate through each column in this row.
-
Method Details
-
column
Get a column in this row. Column is identified by its name.- Parameters:
name
- column name- Returns:
- a column in this row
-
column
Get a column in this row. Column is identified by its index.- Parameters:
index
- column index starting from1
- Returns:
- a column in this row
- Throws:
IndexOutOfBoundsException
- if column with provided index does not exist
-
forEach
Iterate through each column in this row.- Parameters:
columnAction
- what to do with each column
-
as
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
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
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 a target class instance fromDbRow
- Returns:
- instance of requested class containing this database row
-