Package io.micronaut.data.r2dbc.mapper
Class ColumnIndexR2dbcResultReader
- java.lang.Object
-
- io.micronaut.data.r2dbc.mapper.ColumnIndexR2dbcResultReader
-
- All Implemented Interfaces:
ResultReader<io.r2dbc.spi.Row,java.lang.Integer>
public class ColumnIndexR2dbcResultReader extends java.lang.Object implements ResultReader<io.r2dbc.spi.Row,java.lang.Integer>
Implementation ofResultReaderfor R2DBC.- Since:
- 1.0.0
- Author:
- graemerocher
-
-
Constructor Summary
Constructors Constructor Description ColumnIndexR2dbcResultReader()ColumnIndexR2dbcResultReader(DataConversionService<?> conversionService)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.micronaut.core.convert.ConversionService<?>getConversionService()Get conversion service.<T> TgetRequiredValue(io.r2dbc.spi.Row resultSet, java.lang.Integer name, java.lang.Class<T> type)Get a value from the given result set for the given name and type.booleannext(io.r2dbc.spi.Row resultSet)Move the index to the next result if possible.java.math.BigDecimalreadBigDecimal(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a BigDecimal value for the given name.booleanreadBoolean(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a boolean value for the given name.bytereadByte(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a byte value for the given name.byte[]readBytes(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a byte[] value for the given name.charreadChar(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a char value for the given name.java.util.DatereadDate(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a date value for the given name.doublereadDouble(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a double value for the given name.java.lang.ObjectreadDynamic(io.r2dbc.spi.Row resultSet, java.lang.Integer index, DataType dataType)Read a value dynamically using the result set and the given name and data type.floatreadFloat(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a float value for the given name.intreadInt(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a int value for the given name.longreadLong(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a long value for the given name.shortreadShort(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a short value for the given name.java.lang.StringreadString(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Read a string value for the given name.java.util.DatereadTimestamp(io.r2dbc.spi.Row resultSet, java.lang.Integer 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, convertRequired, readUUID
-
-
-
-
Constructor Detail
-
ColumnIndexR2dbcResultReader
public ColumnIndexR2dbcResultReader()
-
ColumnIndexR2dbcResultReader
public ColumnIndexR2dbcResultReader(DataConversionService<?> conversionService)
Constructs a new instance.- Parameters:
conversionService- The data conversion service- Since:
- 3.1
-
-
Method Detail
-
getConversionService
public io.micronaut.core.convert.ConversionService<?> getConversionService()
Description copied from interface:ResultReaderGet conversion service.- Specified by:
getConversionServicein interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Returns:
- the instance of
ConversionService
-
readDynamic
@Nullable public java.lang.Object readDynamic(@NonNull io.r2dbc.spi.Row resultSet, @NonNull java.lang.Integer index, @NonNull DataType dataType)Description copied from interface:ResultReaderRead a value dynamically using the result set and the given name and data type.- Specified by:
readDynamicin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setindex- The namedataType- The data type- Returns:
- The value, can be null
-
readLong
public long readLong(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a long value for the given name.- Specified by:
readLongin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The long value
-
readChar
public char readChar(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a char value for the given name.- Specified by:
readCharin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The char value
-
readDate
public java.util.Date readDate(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a date value for the given name.- Specified by:
readDatein interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The char value
-
readTimestamp
public java.util.Date readTimestamp(io.r2dbc.spi.Row resultSet, java.lang.Integer index)Description copied from interface:ResultReaderRead a timestamp value for the given index.- Specified by:
readTimestampin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setindex- The index (such as the column name)- Returns:
- The char value
-
readString
@Nullable public java.lang.String readString(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a string value for the given name.- Specified by:
readStringin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The string value
-
readInt
public int readInt(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a int value for the given name.- Specified by:
readIntin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The int value
-
readBoolean
public boolean readBoolean(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a boolean value for the given name.- Specified by:
readBooleanin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The boolean value
-
readFloat
public float readFloat(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a float value for the given name.- Specified by:
readFloatin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The float value
-
readByte
public byte readByte(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a byte value for the given name.- Specified by:
readBytein interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The byte value
-
readShort
public short readShort(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a short value for the given name.- Specified by:
readShortin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The short value
-
readDouble
public double readDouble(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a double value for the given name.- Specified by:
readDoublein interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The double value
-
readBigDecimal
public java.math.BigDecimal readBigDecimal(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a BigDecimal value for the given name.- Specified by:
readBigDecimalin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The BigDecimal value
-
readBytes
public byte[] readBytes(io.r2dbc.spi.Row resultSet, java.lang.Integer name)Description copied from interface:ResultReaderRead a byte[] value for the given name.- Specified by:
readBytesin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The byte[] value
-
getRequiredValue
@Nullable public <T> T getRequiredValue(io.r2dbc.spi.Row resultSet, java.lang.Integer name, java.lang.Class<T> type) throws DataAccessExceptionDescription copied from interface:ResultReaderGet a value from the given result set for the given name and type.- Specified by:
getRequiredValuein interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- 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
public boolean next(io.r2dbc.spi.Row resultSet)
Description copied from interface:ResultReaderMove the index to the next result if possible.- Specified by:
nextin interfaceResultReader<io.r2dbc.spi.Row,java.lang.Integer>- Parameters:
resultSet- The result set- Returns:
- The next result
-
-