Package io.micronaut.data.runtime.mapper
Interface ResultReader<RS,IDX>
- Type Parameters:
RS
- The result setIDX
- The index type
- All Known Implementing Classes:
ColumnIndexR2dbcResultReader
,ColumnIndexResultSetReader
,ColumnNameR2dbcResultReader
,ColumnNameResultSetReader
public interface ResultReader<RS,IDX>
A result reader is a type that is capable of reading data from the given result set type.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> T
convertRequired
(@NonNull Object value, io.micronaut.core.type.Argument<T> type) Convert the value to the given type.default <T> T
convertRequired
(@NonNull Object value, Class<T> type) Convert the value to the given type.default io.micronaut.core.convert.ConversionService
Get conversion service.<T> T
getRequiredValue
(RS resultSet, IDX name, Class<T> type) Get a value from the given result set for the given name and type.boolean
Move the index to the next result if possible.default BigDecimal
readBigDecimal
(RS resultSet, IDX name) Read a BigDecimal value for the given name.default boolean
readBoolean
(RS resultSet, IDX name) Read a boolean value for the given name.default byte
Read a byte value for the given name.default byte[]
Read a byte[] value for the given name.default char
Read a char value for the given name.default Date
Read a date value for the given name.default double
readDouble
(RS resultSet, IDX name) Read a double value for the given name.default @Nullable Object
readDynamic
(RS resultSet, IDX index, @NonNull DataType dataType) Read a value dynamically using the result set and the given name and data type.default float
Read a float value for the given name.default int
Read a int value for the given name.default long
Read a long value for the given name.default short
Read a short value for the given name.default @Nullable String
readString
(RS resultSet, IDX name) Read a string value for the given name.default Time
Read a time value for the given index.default Date
readTimestamp
(RS resultSet, IDX index) Read a timestamp value for the given index.default @Nullable UUID
Read a UUID value for the given name.
-
Method Details
-
convertRequired
Convert the value to the given type.- Type Parameters:
T
- The generic type- Parameters:
value
- The valuetype
- The type- Returns:
- The converted value
- Throws:
DataAccessException
- if the value cannot be converted
-
convertRequired
default <T> T convertRequired(@NonNull @NonNull Object value, io.micronaut.core.type.Argument<T> type) Convert the value to the given type.- Type Parameters:
T
- The generic type- Parameters:
value
- The valuetype
- The type- Returns:
- The converted value
- Throws:
DataAccessException
- if the value cannot be converted
-
getRequiredValue
Get a value from the given result set for the given name and type.- Type Parameters:
T
- The generic type- Parameters:
resultSet
- The result setname
- The nametype
- The type- Returns:
- The value
- Throws:
DataAccessException
- if the value cannot be read
-
next
Move the index to the next result if possible.- Parameters:
resultSet
- The result set- Returns:
- The next result
-
readDynamic
@Nullable default @Nullable Object readDynamic(@NonNull RS resultSet, @NonNull IDX index, @NonNull @NonNull DataType dataType) Read a value dynamically using the result set and the given name and data type.- Parameters:
resultSet
- The result setindex
- The namedataType
- The data type- Returns:
- The value, can be null
- Throws:
DataAccessException
- if the value cannot be read
-
readLong
Read a long value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The long value
-
readChar
Read a char value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The char value
-
readDate
Read a date value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The char value
-
readTimestamp
Read a timestamp value for the given index.- Parameters:
resultSet
- The result setindex
- The index (such as the column name)- Returns:
- The char value
-
readTime
Read a time value for the given index.- Parameters:
resultSet
- The result setindex
- The index (such as the column name)- Returns:
- The char value
-
readString
Read a string value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The string value
-
readUUID
Read a UUID value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The string value
-
readInt
Read a int value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The int value
-
readBoolean
Read a boolean value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The boolean value
-
readFloat
Read a float value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The float value
-
readByte
Read a byte value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The byte value
-
readShort
Read a short value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The short value
-
readDouble
Read a double value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The double value
-
readBigDecimal
Read a BigDecimal value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The BigDecimal value
-
readBytes
Read a byte[] value for the given name.- Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The byte[] value
-
getConversionService
default io.micronaut.core.convert.ConversionService getConversionService()Get conversion service.- Returns:
- the instance of
ConversionService
-