Package io.micronaut.data.jdbc.mapper
Class ColumnNameResultSetReader
java.lang.Object
io.micronaut.data.jdbc.mapper.ColumnNameResultSetReader
- All Implemented Interfaces:
ResultReader<ResultSet,
String>
public final class ColumnNameResultSetReader
extends Object
implements ResultReader<ResultSet,String>
A
ResultReader
for JDBC that uses the column name.- Since:
- 1.0.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorDescriptionColumnNameResultSetReader
(DataConversionService conversionService) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescription<T> T
convertRequired
(@NonNull Object value, Class<T> type) Convert the value to the given type.io.micronaut.core.convert.ConversionService
Get conversion service.<T> T
getRequiredValue
(ResultSet resultSet, String 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.readBigDecimal
(ResultSet resultSet, String name) Read a BigDecimal value for the given name.boolean
readBoolean
(ResultSet resultSet, String name) Read a boolean value for the given name.byte
Read a byte value for the given name.byte[]
Read a byte[] value for the given name.char
Read a char value for the given name.Read a date value for the given name.double
readDouble
(ResultSet resultSet, String name) Read a double value for the given name.@Nullable Object
readDynamic
(@NonNull ResultSet resultSet, @NonNull String index, @NonNull DataType dataType) Read a value dynamically using the result set and the given name and data type.float
Read a float value for the given name.int
Read an int value for the given name.long
Read a long value for the given name.short
Read a short value for the given name.@Nullable String
readString
(ResultSet resultSet, String name) Read a string value for the given name.Read a time value for the given index.readTimestamp
(ResultSet resultSet, String index) Read a timestamp value for the given index.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.data.runtime.mapper.ResultReader
convertRequired, readUUID
-
Constructor Details
-
ColumnNameResultSetReader
public ColumnNameResultSetReader() -
ColumnNameResultSetReader
Constructs a new instance.- Parameters:
conversionService
- The data conversion service- Since:
- 3.1
-
-
Method Details
-
getConversionService
public io.micronaut.core.convert.ConversionService getConversionService()Description copied from interface:ResultReader
Get conversion service.- Specified by:
getConversionService
in interfaceResultReader<ResultSet,
String> - Returns:
- the instance of
ConversionService
-
readDynamic
@Nullable public @Nullable Object readDynamic(@NonNull @NonNull ResultSet resultSet, @NonNull @NonNull String index, @NonNull @NonNull DataType dataType) Description copied from interface:ResultReader
Read a value dynamically using the result set and the given name and data type.- Specified by:
readDynamic
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setindex
- The namedataType
- The data type- Returns:
- The value, can be null
-
next
Description copied from interface:ResultReader
Move the index to the next result if possible.- Specified by:
next
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result set- Returns:
- The next result
-
convertRequired
Description copied from interface:ResultReader
Convert the value to the given type.- Specified by:
convertRequired
in interfaceResultReader<ResultSet,
String> - Type Parameters:
T
- The generic type- Parameters:
value
- The valuetype
- The type- Returns:
- The converted value
-
readTimestamp
Description copied from interface:ResultReader
Read a timestamp value for the given index.- Specified by:
readTimestamp
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setindex
- The index (such as the column name)- Returns:
- The char value
-
readTime
Description copied from interface:ResultReader
Read a time value for the given index.- Specified by:
readTime
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setindex
- The index (such as the column name)- Returns:
- The char value
-
readLong
Description copied from interface:ResultReader
Read a long value for the given name.- Specified by:
readLong
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The long value
-
readChar
Description copied from interface:ResultReader
Read a char value for the given name.- Specified by:
readChar
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The char value
-
readDate
Description copied from interface:ResultReader
Read a date value for the given name.- Specified by:
readDate
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The char value
-
readString
Description copied from interface:ResultReader
Read a string value for the given name.- Specified by:
readString
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The string value
-
readInt
Description copied from interface:ResultReader
Read an int value for the given name.- Specified by:
readInt
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The int value
-
readBoolean
Description copied from interface:ResultReader
Read a boolean value for the given name.- Specified by:
readBoolean
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The boolean value
-
readFloat
Description copied from interface:ResultReader
Read a float value for the given name.- Specified by:
readFloat
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The float value
-
readByte
Description copied from interface:ResultReader
Read a byte value for the given name.- Specified by:
readByte
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The byte value
-
readShort
Description copied from interface:ResultReader
Read a short value for the given name.- Specified by:
readShort
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The short value
-
readDouble
Description copied from interface:ResultReader
Read a double value for the given name.- Specified by:
readDouble
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The double value
-
readBigDecimal
Description copied from interface:ResultReader
Read a BigDecimal value for the given name.- Specified by:
readBigDecimal
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The BigDecimal value
-
readBytes
Description copied from interface:ResultReader
Read a byte[] value for the given name.- Specified by:
readBytes
in interfaceResultReader<ResultSet,
String> - Parameters:
resultSet
- The result setname
- The name (such as the column name)- Returns:
- The byte[] value
-
getRequiredValue
public <T> T getRequiredValue(ResultSet resultSet, String name, Class<T> type) throws DataAccessException Description copied from interface:ResultReader
Get a value from the given result set for the given name and type.- Specified by:
getRequiredValue
in interfaceResultReader<ResultSet,
String> - 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
-