Top Description Fields Constructors Methods
org.h2.value

public final Class ValueToObjectConverter

extends TraceObject
Class Inheritance
Imports
java.io.BufferedReader, .InputStream, .Reader, java.math.BigDecimal, .BigInteger, java.sql.Array, .Blob, .Clob, .ResultSet, .ResultSetMetaData, .SQLException, .SQLXML, java.time.Duration, .Instant, .LocalDate, .LocalDateTime, .LocalTime, .OffsetDateTime, .OffsetTime, .Period, .ZonedDateTime, java.util.Iterator, .LinkedHashMap, .Map.Entry, .UUID, org.h2.api.ErrorCode, .Interval, org.h2.engine.Session, org.h2.expression.Format, org.h2.jdbc.JdbcArray, .JdbcBlob, .JdbcClob, .JdbcConnection, .JdbcLob, .JdbcResultSet, .JdbcSQLXML, org.h2.message.DbException, .TraceObject, org.h2.util.JSR310Utils, .JdbcUtils, .LegacyDateTimeUtils

Data type conversion methods between values and Java objects.

Field Summary

Modifier and TypeField and Description
public static final Class<?>
GEOMETRY_CLASS

The Geometry class.

private static final String
Inherited from org.h2.message.TraceObject:
ARRAYBLOBCALLABLE_STATEMENTCLOBCONNECTIONDATA_SOURCEDATABASE_META_DATAPARAMETER_META_DATAPREPARED_STATEMENTRESULT_SETRESULT_SET_META_DATASAVEPOINTSQLXMLSTATEMENTtraceXA_DATA_SOURCEXID

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static Value
public static Class<?>

Returns:

the class
getDefaultClass
(int
the value type
type
,
boolean
if true get class for JDBC layer, if false get class for Java functions API
forJdbc
)

Get the name of the Java class for the given value type.

public static Value

Returns:

the value
objectToValue
(Session
the session
session
,
Object
the value
x
,
int
the suggested value type, or Value#UNKNOWN
type
)

Convert a Java object to a value.

private static Value
private static LinkedHashMap<String, TypeInfo>
readResultSetMeta(Session session, ResultSetMetaData meta, int columnCount)

public static Value

Returns:

the value
readValue
(Session
the session
session
,
JdbcResultSet
the result set
rs
,
int
the column index (1-based)
columnIndex
)

Read a value from the given result set.

pack-priv static Value
private static Object
valueToArray(Class<?> type, Value value, JdbcConnection conn)

public static Object

Returns:

the object
valueToDefaultArray
(Value
the array value
value
,
JdbcConnection
the connection
conn
,
boolean
if true perform conversion for JDBC layer, if false perform conversion for Java functions API
forJdbc
)

Converts the specified array value to array of default Java objects for its type.

public static Object

Returns:

the object
valueToDefaultObject
(Value
the value
value
,
JdbcConnection
the connection
conn
,
boolean
if true perform conversion for JDBC layer, if false perform conversion for Java functions API
forJdbc
)

Converts the specified value to the default Java object for its type.

public static <
the type
T
>
T

Returns:

the object of the specified class representing the specified value, or null
valueToObject
(Class<T>
the class
type
,
Value
the value
value
,
JdbcConnection
the connection
conn
)

Converts the specified value to an object of the specified type.

private static Object
valueToOther(Class<?> type, Value value, JdbcConnection conn)

Inherited from org.h2.message.TraceObject:
debugCodedebugCodeAssigndebugCodeCalldebugCodeCalldebugCodeCallgetNextIdgetTraceIdgetTraceObjectNameisDebugEnabledisInfoEnabledlogAndConvertquotequoteArrayquoteBigDecimalquoteBytesquoteDatequoteIntArrayquoteMapquoteTimequoteTimestampsetTraceunsupported

Field Detail

GEOMETRY_CLASSback to summary
public static final Class<?> GEOMETRY_CLASS

The Geometry class. This object is null if the JTS jar file is not in the classpath.

GEOMETRY_CLASS_NAMEback to summary
private static final String GEOMETRY_CLASS_NAME

Constructor Detail

ValueToObjectConverterback to summary
private ValueToObjectConverter()

Method Detail

arrayToValueback to summary
private static Value arrayToValue(Session session, Object x)
getDefaultClassback to summary
public static Class<?> getDefaultClass(int type, boolean forJdbc)

Get the name of the Java class for the given value type.

Parameters
type:int

the value type

forJdbc:boolean

if true get class for JDBC layer, if false get class for Java functions API

Returns:Class<?>

the class

objectToValueback to summary
public static Value objectToValue(Session session, Object x, int type)

Convert a Java object to a value.

Parameters
session:Session

the session

x:Object

the value

type:int

the suggested value type, or Value#UNKNOWN

Returns:Value

the value

otherToValueback to summary
private static Value otherToValue(Session session, Object x)
readResultSetMetaback to summary
private static LinkedHashMap<String, TypeInfo> readResultSetMeta(Session session, ResultSetMetaData meta, int columnCount) throws SQLException
readValueback to summary
public static Value readValue(Session session, JdbcResultSet rs, int columnIndex)

Read a value from the given result set.

Parameters
session:Session

the session

rs:JdbcResultSet

the result set

columnIndex:int

the column index (1-based)

Returns:Value

the value

resultSetToValueback to summary
pack-priv static Value resultSetToValue(Session session, ResultSet rs)
valueToArrayback to summary
private static Object valueToArray(Class<?> type, Value value, JdbcConnection conn)
valueToDefaultArrayback to summary
public static Object valueToDefaultArray(Value value, JdbcConnection conn, boolean forJdbc)

Converts the specified array value to array of default Java objects for its type.

Parameters
value:Value

the array value

conn:JdbcConnection

the connection

forJdbc:boolean

if true perform conversion for JDBC layer, if false perform conversion for Java functions API

Returns:Object

the object

valueToDefaultObjectback to summary
public static Object valueToDefaultObject(Value value, JdbcConnection conn, boolean forJdbc)

Converts the specified value to the default Java object for its type.

Parameters
value:Value

the value

conn:JdbcConnection

the connection

forJdbc:boolean

if true perform conversion for JDBC layer, if false perform conversion for Java functions API

Returns:Object

the object

valueToObjectback to summary
public static <T> T valueToObject(Class<T> type, Value value, JdbcConnection conn)

Converts the specified value to an object of the specified type.

Parameters
<T>
the type
type:Class<T>

the class

value:Value

the value

conn:JdbcConnection

the connection

Returns:T

the object of the specified class representing the specified value, or null

Annotations
@SuppressWarnings:unchecked
valueToOtherback to summary
private static Object valueToOther(Class<?> type, Value value, JdbcConnection conn)