public interface Readable
OUT
parameters from a database query, later on referred to as items.
Values can for columns or OUT
parameters be either retrieved by specifying a name or the index.
Indexes are 0
-based.
Column and OUT
parameter names used as input to getter methods are case insensitive.
When a get
method is called with a name and several items have the same name, then the value of the first matching item will be returned.
Items that are not explicitly named in the query should be referenced through indexes.
For maximum portability, items within each Readable
should be read in left-to-right order, and each item should be read only once.
get(String)
and get(int)
without specifying a target type returns a suitable value representation. The R2DBC specification contains a mapping table that shows default
mappings between database types and Java types.
Specifying a target type, the R2DBC driver attempts to convert the value to the target type.
A item is invalidated after consumption.
Row
,
OutParameters
Modifier and Type | Method and Description |
---|---|
default Object |
get(int index)
Returns the value using the default type mapping.
|
<T> T |
get(int index,
Class<T> type)
Returns the value for a parameter.
|
default Object |
get(String name)
Returns the value for a parameter using the default type mapping.
|
<T> T |
get(String name,
Class<T> type)
Returns the value.
|
@Nullable default Object get(int index)
get(int, Class)
passing Object
as the type
to allow the implementation to make the loosest possible match.index
- the index of the parameter starting at 0
null
.IndexOutOfBoundsException
- if index
if the index is out of range (negative or equals/exceeds the number of readable objects)@Nullable <T> T get(int index, Class<T> type)
Object
to allow the implementation to make the loosest possible match.T
- the type of the item being returned.index
- the index starting at 0
type
- the type of item to return. This type must be assignable to, and allows for variance.null
.IllegalArgumentException
- if type
is null
IndexOutOfBoundsException
- if index
is out of range (negative or equals/exceeds the number of readable objects)@Nullable default Object get(String name)
get(String, Class)
passing Object
as the type in
order to allow the implementation to make the loosest possible match.name
- the namenull
.IllegalArgumentException
- if name
is null
NoSuchElementException
- if name
is not a known readable column or out parameter@Nullable <T> T get(String name, Class<T> type)
Object
to allow the implementation to make the loosest possible match.T
- the type of the item being returned.name
- the nametype
- the type of item to return. This type must be assignable to, and allows for variance.null
.IllegalArgumentException
- if name
or type
is null
NoSuchElementException
- if name
is not a known readable column or out parameterCopyright © 2021. All rights reserved.