public interface ReadableMetadata
OUT
parameter as result of running a stored procedure.
The implementation of all methods except getName()
is optional for drivers. Metadata is optionally available as by-product of statement execution on a best-effort basis.ColumnMetadata
,
OutParameterMetadata
Modifier and Type | Method and Description |
---|---|
default Class<?> |
getJavaType()
Returns the primary Java
type . |
String |
getName()
Returns the name.
|
default Object |
getNativeTypeMetadata()
Returns the native type descriptor that potentially exposes more metadata.
|
default Nullability |
getNullability()
Returns the nullability of values.
|
default Integer |
getPrecision()
Returns the precision.
|
default Integer |
getScale()
Returns the scale.
|
Type |
getType()
Returns the database
Type . |
@Nullable default Class<?> getJavaType()
type
. This type can be considered the native representation that is used to exchange values with the least loss in precision.
Implementation notes
Drivers should implement this method. The method should return the actual type and refrain from returning Object.class
. The default implementation returns null
.
Drivers may need to inspect the value and perform parts of decoding to determine the native Java type. This method
should be expected to run in non-constant time.
type
or null
if the type is not available.Readable.get(int)
,
Readable.get(int)
String getName()
The name does not necessarily reflect the names how they are in the underlying tables but rather how results are represented (e.g. aliased) in the result.
@Nullable default Object getNativeTypeMetadata()
Implementation notes
Drivers should implement this method if they can expose a driver-specific type metadata object exposing additional information. The default implementation returns null
.
null
if no native type descriptor is available.default Nullability getNullability()
Implementation notes
Implementation of this method is optional. The default implementation returns Nullability.UNKNOWN
.
Nullability
@Nullable default Integer getPrecision()
For numeric data, this is the maximum precision.
For character data, this is the length in characters.
For datetime data types, this is the length in bytes required to represent the value (assuming the
maximum allowed precision of the fractional seconds component).
For binary data, this is the length in bytes.
Returns null
for data types where data type size is not applicable or if the precision cannot be provided.
Implementation notes
Implementation of this method is optional. The default implementation returns null
.
null
if the precision is not available.@Nullable default Integer getScale()
This is the number of digits to right of the decimal point.
Returns null
for data types where the scale is not applicable or if the precision cannot be provided.
Implementation notes
Implementation of this method is optional. The default implementation returns null
.
null
if the scale is not available.Copyright © 2021. All rights reserved.