public interface ColumnMetadata
getName()
is optional for drivers. Column metadata is optionally
available as by-product of statement execution on a best-effort basis.Modifier and Type | Method and Description |
---|---|
default Class<?> |
getJavaType()
Returns the primary Java
type . |
String |
getName()
Returns the name of the column.
|
default Object |
getNativeTypeMetadata()
Returns the native type descriptor that potentially exposes more metadata.
|
default Nullability |
getNullability()
Returns the nullability of column values.
|
default Integer |
getPrecision()
Returns the precision of the column.
|
default Integer |
getScale()
Returns the scale of the column.
|
@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.Row.get(int)
String getName()
The name does not necessarily reflect the column names how they are in the underlying tables but rather how columns 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 the column 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 © 2019. All rights reserved.