The type of the result value for each row can be specified. The value for the single column will be extracted from the ResultSet and converted into the specified target type.
| Modifier and Type | Field and Description |
|---|---|
| private Class |
| Access | Constructor and Description |
|---|---|
| public | |
| public | SingleColumnRowMapper(Class<T>
the type that each result object is expected to match requiredType)Create a new SingleColumnRowMapper. |
| Modifier and Type | Method and Description |
|---|---|
| protected Object | Returns: the converted valuethe column value as extracted from value, Class<T> getColumnValue()
(never null)the type that each result object is expected to match
(never requiredType)null)Convert the given column value to the specified required type. |
| protected Object | Returns: the Object valueis the ResultSet holding the data rs, int is the column index index, Class<T> the type that each result object is expected to match
(or requiredType)null if none specified)Retrieve a JDBC object value for the specified column. |
| protected Object | Returns: the Object valueis the ResultSet holding the data rs, int is the column index index)Retrieve a JDBC object value for the specified column, using the most appropriate value type. |
| public Object | mapRow(ResultSet
the ResultSet to map (pre-initialized for the current row) rs, int the number of the current row rowNum)Implements liquibase. Extract a value for the single column in the current row. |
| public void |
| requiredType | back to summary |
|---|---|
| private Class<T> requiredType | |
| SingleColumnRowMapper | back to summary |
|---|---|
| public SingleColumnRowMapper() Create a new SingleColumnRowMapper.
| |
| SingleColumnRowMapper | back to summary |
|---|---|
| public SingleColumnRowMapper(Class<T> requiredType) Create a new SingleColumnRowMapper.
| |
| convertValueToRequiredType | back to summary |
|---|---|
| protected Object convertValueToRequiredType(Object value, Class<T> requiredType) Convert the given column value to the specified required type. Only called if the extracted column value does not match already. If the required type is String, the value will simply get stringified
via
| |
| getColumnValue | back to summary |
|---|---|
| protected Object getColumnValue(ResultSet rs, int index, Class<T> requiredType) throws SQLException Retrieve a JDBC object value for the specified column. The default implementation calls If no required type has been specified, this method delegates to
Explicit extraction of a String is necessary to properly extract an Oracle RAW value as a String, for example. For the other given types, it is also recommendable to extract the desired types explicitly, to let the JDBC driver perform appropriate (potentially database-specific) conversion.
| |
| getColumnValue | back to summary |
|---|---|
| protected Object getColumnValue(ResultSet rs, int index) throws SQLException Retrieve a JDBC object value for the specified column, using the most appropriate value type. Called if no required type has been specified. The default implementation delegates to | |
| mapRow | back to summary |
|---|---|
| public Object mapRow(ResultSet rs, int rowNum) throws SQLException Implements liquibase. Extract a value for the single column in the current row. Validates that there is only one column selected,
then delegates to
| |
| setRequiredType | back to summary |
|---|---|
| public void setRequiredType(Class<T> requiredType) Set the type that each result object is expected to match. If not specified, the column value will be exposed as returned by the JDBC driver. | |