Package com.clickhouse.client.data
Class ClickHouseDateValue
- java.lang.Object
-
- com.clickhouse.client.data.ClickHouseObjectValue<LocalDate>
-
- com.clickhouse.client.data.ClickHouseDateValue
-
- All Implemented Interfaces:
ClickHouseValue
,Serializable
public class ClickHouseDateValue extends ClickHouseObjectValue<LocalDate>
Wraper class of LocalDate.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClickHouseDateValue(LocalDate value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigDecimal
asBigDecimal(int scale)
Gets value asBigDecimal
.BigInteger
asBigInteger()
Gets value asBigInteger
.byte
asByte()
Gets value as byte.LocalDate
asDate()
Gets value asLocalDate
.LocalDateTime
asDateTime(int scale)
Gets value asLocalDateTime
.double
asDouble()
Gets value as double.float
asFloat()
Gets value as float.int
asInteger()
Gets value as integer.long
asLong()
Gets value as long.short
asShort()
Gets value as short.String
asString(int length, Charset charset)
Gets value as fixed length(in bytes) string.LocalTime
asTime(int scale)
Gets value asLocalTime
.ClickHouseDateValue
copy(boolean deep)
Gets a copy of this value object.static ClickHouseDateValue
of(long epochDay)
Wrap the given value.static ClickHouseDateValue
of(ClickHouseValue ref, LocalDate value)
Update value of the given object or create a new instance ifref
is null.static ClickHouseDateValue
of(LocalDate value)
Wrap the given value.static ClickHouseDateValue
ofNull()
Create a new instance representing null value.static ClickHouseDateValue
ofNull(ClickHouseValue ref)
Update given value to null or create a new instance ifref
is null.ClickHouseDateValue
resetToDefault()
Resets to default value of corresponding data type.String
toSqlExpression()
Converts the value to escaped SQL expression.ClickHouseDateValue
update(byte value)
Updates value.ClickHouseDateValue
update(double value)
Updates value.ClickHouseDateValue
update(float value)
Updates value.ClickHouseDateValue
update(int value)
Updates value.ClickHouseDateValue
update(long value)
Updates value.ClickHouseDateValue
update(short value)
Updates value.ClickHouseDateValue
update(ClickHouseValue value)
Updates value.ClickHouseDateValue
update(Enum<?> value)
Updates value.ClickHouseDateValue
update(Object value)
Updates value.ClickHouseDateValue
update(String value)
Updates value.ClickHouseDateValue
update(BigDecimal value)
Updates value.ClickHouseDateValue
update(BigInteger value)
Updates value.ClickHouseDateValue
update(LocalDate value)
Updates value.ClickHouseDateValue
update(LocalDateTime value)
Updates value.ClickHouseDateValue
update(LocalTime value)
Updates value.-
Methods inherited from class com.clickhouse.client.data.ClickHouseObjectValue
asObject, equals, getValue, hashCode, isNullOrEmpty, resetToNullOrEmpty, set, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.clickhouse.client.ClickHouseValue
asArray, asArray, asBigDecimal, asBinary, asBinary, asBinary, asBinary, asBoolean, asByteStream, asCharacter, asCharacterStream, asDateTime, asEnum, asInet4Address, asInet6Address, asInstant, asInstant, asMap, asMap, asObject, asOffsetDateTime, asOffsetDateTime, asString, asString, asString, asTime, asTuple, asUuid, asZonedDateTime, asZonedDateTime, copy, isInfinity, isNaN, newUnsupportedException, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, updateUnknown
-
-
-
-
Field Detail
-
DEFAULT
public static final LocalDate DEFAULT
Default date.
-
-
Constructor Detail
-
ClickHouseDateValue
protected ClickHouseDateValue(LocalDate value)
-
-
Method Detail
-
ofNull
public static ClickHouseDateValue ofNull()
Create a new instance representing null value.- Returns:
- new instance representing null value
-
ofNull
public static ClickHouseDateValue ofNull(ClickHouseValue ref)
Update given value to null or create a new instance ifref
is null.- Parameters:
ref
- object to update, could be null- Returns:
- same object as
ref
or a new instance if it's null
-
of
public static ClickHouseDateValue of(LocalDate value)
Wrap the given value.- Parameters:
value
- value- Returns:
- object representing the value
-
of
public static ClickHouseDateValue of(long epochDay)
Wrap the given value.- Parameters:
epochDay
- epoch day- Returns:
- object representing the value
-
of
public static ClickHouseDateValue of(ClickHouseValue ref, LocalDate value)
Update value of the given object or create a new instance ifref
is null.- Parameters:
ref
- object to update, could be nullvalue
- value- Returns:
- same object as
ref
or a new instance if it's null
-
copy
public ClickHouseDateValue copy(boolean deep)
Description copied from interface:ClickHouseValue
Gets a copy of this value object.- Parameters:
deep
- true to create a deep copy; false for a shallow copy- Returns:
- copy of this value object
-
asByte
public byte asByte()
Description copied from interface:ClickHouseValue
Gets value as byte.- Specified by:
asByte
in interfaceClickHouseValue
- Overrides:
asByte
in classClickHouseObjectValue<LocalDate>
- Returns:
- byte value
-
asShort
public short asShort()
Description copied from interface:ClickHouseValue
Gets value as short.- Specified by:
asShort
in interfaceClickHouseValue
- Overrides:
asShort
in classClickHouseObjectValue<LocalDate>
- Returns:
- short value
-
asInteger
public int asInteger()
Description copied from interface:ClickHouseValue
Gets value as integer.- Specified by:
asInteger
in interfaceClickHouseValue
- Overrides:
asInteger
in classClickHouseObjectValue<LocalDate>
- Returns:
- integer value
-
asLong
public long asLong()
Description copied from interface:ClickHouseValue
Gets value as long.- Specified by:
asLong
in interfaceClickHouseValue
- Overrides:
asLong
in classClickHouseObjectValue<LocalDate>
- Returns:
- long value
-
asBigInteger
public BigInteger asBigInteger()
Description copied from interface:ClickHouseValue
Gets value asBigInteger
.- Specified by:
asBigInteger
in interfaceClickHouseValue
- Overrides:
asBigInteger
in classClickHouseObjectValue<LocalDate>
- Returns:
- big integer, could be null
-
asFloat
public float asFloat()
Description copied from interface:ClickHouseValue
Gets value as float.- Specified by:
asFloat
in interfaceClickHouseValue
- Overrides:
asFloat
in classClickHouseObjectValue<LocalDate>
- Returns:
- float value
-
asDouble
public double asDouble()
Description copied from interface:ClickHouseValue
Gets value as double.- Specified by:
asDouble
in interfaceClickHouseValue
- Overrides:
asDouble
in classClickHouseObjectValue<LocalDate>
- Returns:
- double value
-
asBigDecimal
public BigDecimal asBigDecimal(int scale)
Description copied from interface:ClickHouseValue
Gets value asBigDecimal
.- Specified by:
asBigDecimal
in interfaceClickHouseValue
- Overrides:
asBigDecimal
in classClickHouseObjectValue<LocalDate>
- Parameters:
scale
- scale of the decimal- Returns:
- big decimal, could be null
-
asDate
public LocalDate asDate()
Description copied from interface:ClickHouseValue
Gets value asLocalDate
.- Returns:
- date, could be null
-
asTime
public final LocalTime asTime(int scale)
Description copied from interface:ClickHouseValue
Gets value asLocalTime
.- Parameters:
scale
- scale of the date time, between 0 (second) and 9 (nano second)- Returns:
- time, could be null
-
asDateTime
public LocalDateTime asDateTime(int scale)
Description copied from interface:ClickHouseValue
Gets value asLocalDateTime
.- Parameters:
scale
- scale of the date time, between 0 (second) and 9 (nano second)- Returns:
- date time, could be null
-
asString
public String asString(int length, Charset charset)
Description copied from interface:ClickHouseValue
Gets value as fixed length(in bytes) string.- Specified by:
asString
in interfaceClickHouseValue
- Overrides:
asString
in classClickHouseObjectValue<LocalDate>
- Parameters:
length
- byte length of the string, 0 or negative number means unboundedcharset
- charset, null is same as default(UTF-8)- Returns:
- string value, could be null
-
resetToDefault
public ClickHouseDateValue resetToDefault()
Description copied from interface:ClickHouseValue
Resets to default value of corresponding data type.- Returns:
- this object
-
toSqlExpression
public String toSqlExpression()
Description copied from interface:ClickHouseValue
Converts the value to escaped SQL expression. For example, number 123 will be converted to123
, while string "12'3" will be converted to @{code '12\'3'}.- Specified by:
toSqlExpression
in interfaceClickHouseValue
- Overrides:
toSqlExpression
in classClickHouseObjectValue<LocalDate>
- Returns:
- escaped SQL expression
-
update
public ClickHouseDateValue update(byte value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(short value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(int value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(long value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(float value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(double value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(BigInteger value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(BigDecimal value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(Enum<?> value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(LocalDate value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(LocalTime value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(LocalDateTime value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(String value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(ClickHouseValue value)
Description copied from interface:ClickHouseValue
Updates value.- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseDateValue update(Object value)
Description copied from interface:ClickHouseValue
Updates value. This method tries to identify type ofvalue
and then use corresponding update method to proceed. Unknown value will be passed toClickHouseValue.updateUnknown(Object)
.- Specified by:
update
in interfaceClickHouseValue
- Overrides:
update
in classClickHouseObjectValue<LocalDate>
- Parameters:
value
- value to update, could be null- Returns:
- this object
-
-