public abstract class ClickHouseValueParser<T> extends Object
| Constructor and Description |
|---|
ClickHouseValueParser() |
| Modifier and Type | Method and Description |
|---|---|
protected T |
getDefaultValue() |
static <T> ClickHouseValueParser<T> |
getParser(Class<T> clazz) |
static long |
normalizeTime(ClickHouseColumnInfo info,
long time) |
abstract T |
parse(ByteFragment value,
ClickHouseColumnInfo columnInfo,
TimeZone timeZone)
Parses the supplied byte fragment
value using meta data contained
in columnInfo. |
static boolean |
parseBoolean(ByteFragment value,
ClickHouseColumnInfo columnInfo) |
static double |
parseDouble(ByteFragment value,
ClickHouseColumnInfo columnInfo) |
static float |
parseFloat(ByteFragment value,
ClickHouseColumnInfo columnInfo) |
static int |
parseInt(ByteFragment value,
ClickHouseColumnInfo columnInfo) |
static long |
parseLong(ByteFragment value,
ClickHouseColumnInfo columnInfo) |
static short |
parseShort(ByteFragment value,
ClickHouseColumnInfo columnInfo) |
T |
parseWithDefault(ByteFragment value,
ClickHouseColumnInfo columnInfo,
TimeZone resultTimeZone)
Parses the supplied byte fragment
value using meta data contained
in columnInfo. |
public static long normalizeTime(ClickHouseColumnInfo info, long time)
public static <T> ClickHouseValueParser<T> getParser(Class<T> clazz) throws SQLException
SQLExceptionpublic static final int parseInt(ByteFragment value, ClickHouseColumnInfo columnInfo) throws SQLException
SQLExceptionpublic static final long parseLong(ByteFragment value, ClickHouseColumnInfo columnInfo) throws SQLException
SQLExceptionpublic static final boolean parseBoolean(ByteFragment value, ClickHouseColumnInfo columnInfo) throws SQLException
SQLExceptionpublic static final short parseShort(ByteFragment value, ClickHouseColumnInfo columnInfo) throws SQLException
SQLExceptionpublic static final double parseDouble(ByteFragment value, ClickHouseColumnInfo columnInfo) throws SQLException
SQLExceptionpublic static final float parseFloat(ByteFragment value, ClickHouseColumnInfo columnInfo) throws SQLException
SQLExceptionpublic abstract T parse(ByteFragment value, ClickHouseColumnInfo columnInfo, TimeZone timeZone) throws SQLException
value using meta data contained
in columnInfo. Date / time parsing uses resultTimeZone,
unless only local values are involved.value - value as returned from the servercolumnInfo - meta data of the columntimeZone - time zone to be used when parsing dates or timesvalue as an object of type
TSQLException - if the value cannot be parsed under the given circumstancespublic T parseWithDefault(ByteFragment value, ClickHouseColumnInfo columnInfo, TimeZone resultTimeZone) throws SQLException
value using meta data contained
in columnInfo. Date / time parsing uses resultTimeZone,
unless only local values are involved.
If the result would be null, this method will check if there is a default value in place which should be returned instead. The default value depends on the class. This method is intended to be used when parsing numeric values which later need to be converted to primitive, e.g. int or float.
value - value as returned from the server or a default valuecolumnInfo - meta data of the columnresultTimeZone - time zone to be used when parsing dates or timesvalue as an object of type
TSQLException - if the value cannot be parsed under the given circumstancesprotected T getDefaultValue()
Copyright © 2015–2021 ClickHouse. All rights reserved.