public class ColumnValue extends Object implements Comparable<ColumnValue>, Jsonizable, Measurable
| 限定符和类型 | 字段和说明 |
|---|---|
static ColumnValue |
INTERNAL_NULL_VALUE
For internal use only.
|
| 构造器和说明 |
|---|
ColumnValue(Object value,
ColumnType type) |
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
asBinary()
Get the value of the attribute column as a binary string.
|
boolean |
asBoolean()
Get the boolean value of the attribute column.
|
double |
asDouble()
Get the value of the attribute column with DOUBLE type.
|
long |
asLong()
Get the long integer value of the attribute column.
|
String |
asString()
Get the string value of the attribute column.
|
byte[] |
asStringInBytes() |
int |
compareTo(ColumnValue target)
Compare the values of two property columns.
|
boolean |
equals(Object o) |
static ColumnValue |
fromBinary(byte[] value)
Constructs a property column of type
ColumnType.BINARY. |
static ColumnValue |
fromBoolean(boolean value)
Constructs a property column of type
ColumnType.BOOLEAN. |
static ColumnValue |
fromDouble(double value)
Constructs a property column of type
ColumnType.DOUBLE. |
static ColumnValue |
fromLong(long value)
Constructs a property column of type
ColumnType.INTEGER. |
static ColumnValue |
fromString(String value)
Construct an attribute column of type
ColumnType.STRING. |
byte |
getChecksum(byte crc)
Get a checksum using the crc8 algorithm, mainly used to calculate the checksum of a cell
|
int |
getDataSize()
Get the size of the primary key column value, the size calculation formula for each type is as follows:
-
ColumnType.INTEGER: Constant size of 8 bytes
- ColumnType.DOUBLE: Constant size of 8 bytes
- ColumnType.BOOLEAN: Constant size of 1 byte
- ColumnType.BINARY: Size equals the number of bytes
- ColumnType.STRING: Size equals the number of bytes after UTF-8 encoding |
ColumnType |
getType()
Get the type of the attribute column.
|
Object |
getValue() |
int |
hashCode() |
String |
jsonize() |
void |
jsonize(StringBuilder sb,
String newline) |
String |
toString() |
public static ColumnValue INTERNAL_NULL_VALUE
public ColumnValue(Object value, ColumnType type)
public Object getValue()
public int getDataSize()
ColumnType.INTEGER: Constant size of 8 bytes
- ColumnType.DOUBLE: Constant size of 8 bytes
- ColumnType.BOOLEAN: Constant size of 1 byte
- ColumnType.BINARY: Size equals the number of bytes
- ColumnType.STRING: Size equals the number of bytes after UTF-8 encodinggetDataSize 在接口中 Measurablepublic ColumnType getType()
public static ColumnValue fromString(String value)
ColumnType.STRING.
Note: The value must not be a null pointer.
value - A value of string type.public static ColumnValue fromLong(long value)
ColumnType.INTEGER.value - The long integer value.public static ColumnValue fromBinary(byte[] value)
ColumnType.BINARY.
Note: The value cannot be a null pointer.
value - The value of binary string type.public static ColumnValue fromDouble(double value)
ColumnType.DOUBLE.value - A value of type double.public static ColumnValue fromBoolean(boolean value)
ColumnType.BOOLEAN.value - A boolean type value.public String asString()
Currently, the value can only be obtained when the data type is ColumnType.STRING.
public byte[] asStringInBytes()
public long asLong()
Currently, the value can only be retrieved when the data type is ColumnType.INTEGER.
public byte[] asBinary()
Currently, the value can only be obtained when the data type is ColumnType.BINARY.
public double asDouble()
Currently, the value can only be obtained when the data type is ColumnType.DOUBLE.
public boolean asBoolean()
Currently, the value can only be obtained when the data type is ColumnType.BOOLEAN.
public byte getChecksum(byte crc)
throws IOException
crc - initial value of crcIOExceptionpublic int compareTo(ColumnValue target)
Note: Property columns of different types cannot be compared.
compareTo 在接口中 Comparable<ColumnValue>target - public String jsonize()
jsonize 在接口中 Jsonizablepublic void jsonize(StringBuilder sb, String newline)
jsonize 在接口中 JsonizableCopyright © 2025. All Rights Reserved.