Package com.clickhouse.client.data
Class ClickHouseFloatValue
- java.lang.Object
-
- com.clickhouse.client.data.ClickHouseFloatValue
-
- All Implemented Interfaces:
ClickHouseValue
,Serializable
public class ClickHouseFloatValue extends Object implements ClickHouseValue
Wraper class of float.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClickHouseFloatValue(boolean isNull, float 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.double
asDouble()
Gets value as double.float
asFloat()
Gets value as float.int
asInteger()
Gets value as integer.long
asLong()
Gets value as long.Object
asObject()
Gets value as an object.short
asShort()
Gets value as short.String
asString(int length, Charset charset)
Gets value as fixed length(in bytes) string.ClickHouseFloatValue
copy(boolean deep)
Gets a copy of this value object.boolean
equals(Object obj)
float
getValue()
Gets value.int
hashCode()
boolean
isInfinity()
Checks if the value is either positive or negative infinity as defined inDouble
.boolean
isNaN()
Checks if the value is Not-a-Number (NaN).boolean
isNullOrEmpty()
Checks if the value is null, or empty for non-null types like Array, Tuple and Map.static ClickHouseFloatValue
of(float value)
Wrap the given value.static ClickHouseFloatValue
of(ClickHouseValue ref, float value)
Update value of the given object or create a new instance ifref
is null.static ClickHouseFloatValue
of(Number value)
Wrap the given value.static ClickHouseFloatValue
ofNull()
Create a new instance representing null value.static ClickHouseFloatValue
ofNull(ClickHouseValue ref)
Update given value to null or create a new instance ifref
is null.ClickHouseFloatValue
resetToNullOrEmpty()
Resets value to null, or empty when null is not supported(e.g.protected ClickHouseFloatValue
set(boolean isNull, float value)
String
toSqlExpression()
Converts the value to escaped SQL expression.String
toString()
ClickHouseFloatValue
update(boolean value)
Updates value.ClickHouseFloatValue
update(byte value)
Updates value.ClickHouseFloatValue
update(char value)
Updates value.ClickHouseFloatValue
update(double value)
Updates value.ClickHouseFloatValue
update(float value)
Updates value.ClickHouseFloatValue
update(int value)
Updates value.ClickHouseFloatValue
update(long value)
Updates value.ClickHouseFloatValue
update(short value)
Updates value.ClickHouseFloatValue
update(ClickHouseValue value)
Updates value.ClickHouseFloatValue
update(Enum<?> value)
Updates value.ClickHouseFloatValue
update(Object value)
Updates value.ClickHouseFloatValue
update(String value)
Updates value.ClickHouseFloatValue
update(BigDecimal value)
Updates value.ClickHouseFloatValue
update(BigInteger value)
Updates value.-
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, asBoolean, asByteStream, asCharacter, asCharacterStream, asDate, asDateTime, asDateTime, asEnum, asInet4Address, asInet6Address, asMap, asMap, asObject, asOffsetDateTime, asOffsetDateTime, asString, asString, asString, asTime, asTime, asTuple, asUuid, asZonedDateTime, asZonedDateTime, copy, newUnsupportedException, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, update, updateUnknown
-
-
-
-
Method Detail
-
ofNull
public static ClickHouseFloatValue ofNull()
Create a new instance representing null value.- Returns:
- new instance representing null value
-
ofNull
public static ClickHouseFloatValue 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 ClickHouseFloatValue of(float value)
Wrap the given value.- Parameters:
value
- value- Returns:
- object representing the value
-
of
public static ClickHouseFloatValue of(Number value)
Wrap the given value.- Parameters:
value
- value- Returns:
- object representing the value
-
of
public static ClickHouseFloatValue of(ClickHouseValue ref, float 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
-
set
protected ClickHouseFloatValue set(boolean isNull, float value)
-
getValue
public float getValue()
Gets value.- Returns:
- value
-
copy
public ClickHouseFloatValue copy(boolean deep)
Description copied from interface:ClickHouseValue
Gets a copy of this value object.- Specified by:
copy
in interfaceClickHouseValue
- Parameters:
deep
- true to create a deep copy; false for a shallow copy- Returns:
- copy of this value object
-
isInfinity
public boolean isInfinity()
Description copied from interface:ClickHouseValue
Checks if the value is either positive or negative infinity as defined inDouble
.- Specified by:
isInfinity
in interfaceClickHouseValue
- Returns:
- true if it's infinity; false otherwise
-
isNaN
public boolean isNaN()
Description copied from interface:ClickHouseValue
Checks if the value is Not-a-Number (NaN).- Specified by:
isNaN
in interfaceClickHouseValue
- Returns:
- true if the value is NaN; false otherwise
-
isNullOrEmpty
public boolean isNullOrEmpty()
Description copied from interface:ClickHouseValue
Checks if the value is null, or empty for non-null types like Array, Tuple and Map.Please pay attention that only nullability will be considered for String, meaning this method will return
false
for an empty string. This is because String is treated as value-based type instead of a container like Array.- Specified by:
isNullOrEmpty
in interfaceClickHouseValue
- Returns:
- true if the value is null or empty; false otherwise
-
asByte
public byte asByte()
Description copied from interface:ClickHouseValue
Gets value as byte.- Specified by:
asByte
in interfaceClickHouseValue
- Returns:
- byte value
-
asShort
public short asShort()
Description copied from interface:ClickHouseValue
Gets value as short.- Specified by:
asShort
in interfaceClickHouseValue
- Returns:
- short value
-
asInteger
public int asInteger()
Description copied from interface:ClickHouseValue
Gets value as integer.- Specified by:
asInteger
in interfaceClickHouseValue
- Returns:
- integer value
-
asLong
public long asLong()
Description copied from interface:ClickHouseValue
Gets value as long.- Specified by:
asLong
in interfaceClickHouseValue
- Returns:
- long value
-
asBigInteger
public BigInteger asBigInteger()
Description copied from interface:ClickHouseValue
Gets value asBigInteger
.- Specified by:
asBigInteger
in interfaceClickHouseValue
- Returns:
- big integer, could be null
-
asFloat
public float asFloat()
Description copied from interface:ClickHouseValue
Gets value as float.- Specified by:
asFloat
in interfaceClickHouseValue
- Returns:
- float value
-
asDouble
public double asDouble()
Description copied from interface:ClickHouseValue
Gets value as double.- Specified by:
asDouble
in interfaceClickHouseValue
- Returns:
- double value
-
asBigDecimal
public BigDecimal asBigDecimal(int scale)
Description copied from interface:ClickHouseValue
Gets value asBigDecimal
.- Specified by:
asBigDecimal
in interfaceClickHouseValue
- Parameters:
scale
- scale of the decimal- Returns:
- big decimal, could be null
-
asObject
public Object asObject()
Description copied from interface:ClickHouseValue
Gets value as an object.- Specified by:
asObject
in interfaceClickHouseValue
- Returns:
- an object representing the value, 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
- 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
-
resetToNullOrEmpty
public ClickHouseFloatValue resetToNullOrEmpty()
Description copied from interface:ClickHouseValue
Resets value to null, or empty when null is not supported(e.g. Array, Tuple and Map etc.).Keep in mind that String is value-based type, so this method will change its value to null instead of an empty string.
- Specified by:
resetToNullOrEmpty
in interfaceClickHouseValue
- 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
- Returns:
- escaped SQL expression
-
update
public ClickHouseFloatValue update(boolean value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(char value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(byte value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(short value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(int value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(long value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(float value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(double value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(BigInteger value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(BigDecimal value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(Enum<?> value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(String value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue update(ClickHouseValue value)
Description copied from interface:ClickHouseValue
Updates value.- Specified by:
update
in interfaceClickHouseValue
- Parameters:
value
- value to update- Returns:
- this object
-
update
public ClickHouseFloatValue 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
- Parameters:
value
- value to update, could be null- Returns:
- this object
-
-