Interface ResultReaderAttributeConverter<X,Y>
- Type Parameters:
X- The entity value typeY- The persisted value type (driver/native type)
- All Superinterfaces:
AttributeConverter<X,Y>
@Indexed(ResultReaderAttributeConverter.class)
public interface ResultReaderAttributeConverter<X,Y>
extends AttributeConverter<X,Y>
ResultReader-aware attribute converter contract for SQL-like stores (JDBC/R2DBC).
Extends the generic AttributeConverter with a helper to read raw column values via a
ResultReader. The returned raw value is then converted to the entity value using
AttributeConverter.convertToEntityValue(Object, ConversionContext).
The ConversionContext may carry additional metadata and, when it is an instance of
DatabaseTypeConversionContext, it exposes the database type
associated with the current operation.
Implementations adapt between the entity-facing type X and the persisted driver type Y.
- Since:
- 5.0.0
- Author:
- Nemanja Mikic
-
Method Summary
Modifier and TypeMethodDescription<R,I> @Nullable Object readFromResultSet(DatabaseTypeConversionContext conversionContext, ResultReader<R, I> reader, R resultSet, I columnName) Read a column value from a native result set via the provided converter-aware reader.Methods inherited from interface AttributeConverter
convertToEntityValue, convertToPersistedValue
-
Method Details
-
readFromResultSet
<R,I> @Nullable Object readFromResultSet(DatabaseTypeConversionContext conversionContext, ResultReader<R, I> reader, R resultSet, I columnName) Read a column value from a native result set via the provided converter-aware reader.The returned value should be of the persisted type (
Y) expected byAttributeConverter.convertToEntityValue(Object, ConversionContext).The result set and column identifier types are tied to the reader generics.
- Type Parameters:
R- The native result set type (e.g.java.sql.ResultSetorio.r2dbc.spi.Row)I- The column identifier type expected by the reader (e.g.Integerindex orStringname)- Parameters:
conversionContext- the conversion context (may carry dialect and argument metadata)reader- the converter-aware result reader for the underlying driverresultSet- the native row/result set object (e.g.java.sql.ResultSet, R2DBCio.r2dbc.spi.Row, etc.)columnName- the column identifier (index or name) as required by the reader- Returns:
- the raw persisted value to be converted into the entity value, or
nullif the column is SQL NULL - Since:
- 5.0.0
-