Class AbstractDelegatingResultReader<RS,ID>
java.lang.Object
io.micronaut.data.runtime.mapper.AbstractDelegatingResultReader<RS,ID>
- Type Parameters:
RS- The result setID- The index type
- All Implemented Interfaces:
ResultReader<RS,ID>
- Direct Known Subclasses:
ColumnNameExistenceAwareCallableResultReader, ColumnNameExistenceAwareR2dbcResultSetReader, ColumnNameExistenceAwareReadableR2dbcResultReader, ColumnNameExistenceAwareResultSetReader
@Internal
public abstract class AbstractDelegatingResultReader<RS,ID>
extends Object
implements ResultReader<RS,ID>
The delegating
ResultReader.- Since:
- 4.9
- Author:
- Denis Stepanov
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDelegatingResultReader(ResultReader<RS, ID> delegate) -
Method Summary
Modifier and TypeMethodDescriptioncolumnResolutionKey(RS resultSet) The object the resolved column ordinals belong to, compared by identity by callers that cache them.<T> TconvertRequired(Object value, io.micronaut.core.type.Argument<T> type) Convert the value to the given type.<T> TconvertRequired(Object value, Class<T> type) Convert the value to the given type.intfindColumnIndex(RS resultSet, String columnName) Resolves the ordinal of the column with the given name in the result set, so that callers can cache it and read the values of subsequent rows by index usingResultReader.getColumnIndexReader()instead of resolving the column name for every row.@Nullable ResultReader<RS, Integer> The reader capable of reading values by the ordinals resolved byResultReader.findColumnIndex(Object, String).io.micronaut.core.convert.ConversionServiceGet conversion service.<T> @Nullable TgetRequiredValue(RS resultSet, ID name, Class<T> type) Get a value from the given result set for the given name and type.<T> TgetRequiredValueNonNull(RS resultSet, ID name, Class<T> type) Get a value from the given result set for the given name and type.booleanMove the index to the next result if possible.@Nullable BigDecimalreadBigDecimal(RS resultSet, ID name) Read a BigDecimal value for the given name.booleanreadBoolean(RS resultSet, ID name) Read a boolean value for the given name.byteRead a byte value for the given name.byte @Nullable []Read a byte[] value for the given name.charRead a char value for the given name.@Nullable DateRead a date value for the given name.doublereadDouble(RS resultSet, ID name) Read a double value for the given name.@Nullable ObjectreadDynamic(RS resultSet, ID index, DataType dataType) Read a value dynamically using the result set and the given name and data type.floatRead a float value for the given name.intRead an int value for the given name.longRead a long value for the given name.shortRead a short value for the given name.@Nullable StringreadString(RS resultSet, ID name) Read a string value for the given name.@Nullable TimeRead a time value for the given index.@Nullable DatereadTimestamp(RS resultSet, ID index) Read a timestamp value for the given index.@Nullable UUIDRead a UUID value for the given name.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ResultReader
readDuration, readPeriod
-
Field Details
-
delegate
-
-
Constructor Details
-
AbstractDelegatingResultReader
-
-
Method Details
-
convertRequired
Description copied from interface:ResultReaderConvert the value to the given type.- Specified by:
convertRequiredin interfaceResultReader<RS,ID> - Type Parameters:
T- The generic type- Parameters:
value- The valuetype- The type- Returns:
- The converted value
-
convertRequired
Description copied from interface:ResultReaderConvert the value to the given type.- Specified by:
convertRequiredin interfaceResultReader<RS,ID> - Type Parameters:
T- The generic type- Parameters:
value- The valuetype- The type- Returns:
- The converted value
-
getRequiredValue
public <T> @Nullable T getRequiredValue(RS resultSet, ID name, Class<T> type) throws DataAccessException Description copied from interface:ResultReaderGet a value from the given result set for the given name and type.- Specified by:
getRequiredValuein interfaceResultReader<RS,ID> - 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
-
getRequiredValueNonNull
public <T> T getRequiredValueNonNull(RS resultSet, ID name, Class<T> type) throws DataAccessException Description copied from interface:ResultReaderGet a value from the given result set for the given name and type.- Specified by:
getRequiredValueNonNullin interfaceResultReader<RS,ID> - 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
Description copied from interface:ResultReaderMove the index to the next result if possible.- Specified by:
nextin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result set- Returns:
- The next result
-
findColumnIndex
Description copied from interface:ResultReaderResolves the ordinal of the column with the given name in the result set, so that callers can cache it and read the values of subsequent rows by index usingResultReader.getColumnIndexReader()instead of resolving the column name for every row.The returned ordinal is only valid for the given result set and uses the index convention of the underlying driver (for example 1-based for JDBC). Readers that cannot resolve column ordinals return
-1, in which case callers must keep reading by name.- Specified by:
findColumnIndexin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setcolumnName- The column name- Returns:
- The column index or
-1if the column cannot be resolved
-
getColumnIndexReader
Description copied from interface:ResultReaderThe reader capable of reading values by the ordinals resolved byResultReader.findColumnIndex(Object, String).- Specified by:
getColumnIndexReaderin interfaceResultReader<RS,ID> - Returns:
- The column index reader or
nullif reading by column index is not supported
-
columnResolutionKey
Description copied from interface:ResultReaderThe object the resolved column ordinals belong to, compared by identity by callers that cache them. It is the result set itself when the result set spans every row, which is the case for JDBC. Readers whose result set object is a single row, which is the case for R2DBC, return something shared by the rows of one result, such as the row metadata, so that the ordinals survive from one row to the next.Returning a different object per row is safe: the ordinals are then resolved again for each row.
- Specified by:
columnResolutionKeyin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result set- Returns:
- The object the resolved ordinals belong to
-
readDynamic
Description copied from interface:ResultReaderRead a value dynamically using the result set and the given name and data type.- Specified by:
readDynamicin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setindex- The namedataType- The data type- Returns:
- The value, can be null
-
readLong
Description copied from interface:ResultReaderRead a long value for the given name.- Specified by:
readLongin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The long value
-
readChar
Description copied from interface:ResultReaderRead a char value for the given name.- Specified by:
readCharin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The char value
-
readDate
Description copied from interface:ResultReaderRead a date value for the given name.- Specified by:
readDatein interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The char value
-
readTimestamp
Description copied from interface:ResultReaderRead a timestamp value for the given index.- Specified by:
readTimestampin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setindex- The index (such as the column name)- Returns:
- The char value
-
readTime
Description copied from interface:ResultReaderRead a time value for the given index.- Specified by:
readTimein interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setindex- The index (such as the column name)- Returns:
- The char value
-
readString
Description copied from interface:ResultReaderRead a string value for the given name.- Specified by:
readStringin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The string value
-
readUUID
Description copied from interface:ResultReaderRead a UUID value for the given name.- Specified by:
readUUIDin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The string value
-
readInt
Description copied from interface:ResultReaderRead an int value for the given name.- Specified by:
readIntin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The int value
-
readBoolean
Description copied from interface:ResultReaderRead a boolean value for the given name.- Specified by:
readBooleanin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The boolean value
-
readFloat
Description copied from interface:ResultReaderRead a float value for the given name.- Specified by:
readFloatin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The float value
-
readByte
Description copied from interface:ResultReaderRead a byte value for the given name.- Specified by:
readBytein interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The byte value
-
readShort
Description copied from interface:ResultReaderRead a short value for the given name.- Specified by:
readShortin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The short value
-
readDouble
Description copied from interface:ResultReaderRead a double value for the given name.- Specified by:
readDoublein interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The double value
-
readBigDecimal
Description copied from interface:ResultReaderRead a BigDecimal value for the given name.- Specified by:
readBigDecimalin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The BigDecimal value
-
readBytes
Description copied from interface:ResultReaderRead a byte[] value for the given name.- Specified by:
readBytesin interfaceResultReader<RS,ID> - Parameters:
resultSet- The result setname- The name (such as the column name)- Returns:
- The byte[] value
-
getConversionService
public io.micronaut.core.convert.ConversionService getConversionService()Description copied from interface:ResultReaderGet conversion service.- Specified by:
getConversionServicein interfaceResultReader<RS,ID> - Returns:
- the instance of
ConversionService
-