public class PrimaryKeyValue extends Object implements Comparable<PrimaryKeyValue>
限定符和类型 | 字段和说明 |
---|---|
static PrimaryKeyValue |
INF_MAX
表示主键值范围的最大值。
|
static PrimaryKeyValue |
INF_MIN
表示主键值范围的最小值。
|
限定符和类型 | 方法和说明 |
---|---|
byte[] |
asBinary() |
long |
asLong()
转换为长整型。
|
String |
asString() |
int |
compareTo(PrimaryKeyValue target)
比较两个主键列的值的大小。
|
boolean |
equals(Object o) |
static PrimaryKeyValue |
fromBinary(byte[] value) |
static PrimaryKeyValue |
fromColumn(ColumnValue value) |
static PrimaryKeyValue |
fromLong(long value)
|
static PrimaryKeyValue |
fromString(String value)
|
int |
getSize()
获取主键列值的大小,各类型大小计算公式为:
-
PrimaryKeyType.INTEGER : 恒定大小为8个字节
- PrimaryKeyType.STRING : 大小为按UTF-8编码后的字节数 |
PrimaryKeyType |
getType()
获取值的数据类型。
|
int |
hashCode() |
boolean |
isInfMax() |
boolean |
isInfMin() |
String |
toString() |
public static final PrimaryKeyValue INF_MAX
public static final PrimaryKeyValue INF_MIN
public PrimaryKeyType getType()
public int getSize()
PrimaryKeyType.INTEGER
: 恒定大小为8个字节
- PrimaryKeyType.STRING
: 大小为按UTF-8编码后的字节数public static PrimaryKeyValue fromString(String value)
value
- String
对象。public static PrimaryKeyValue fromLong(long value)
value
- int
值。public String asString()
public long asLong()
PrimaryKeyType.INTEGER
时转换能够成功。long值。
public static PrimaryKeyValue fromBinary(byte[] value)
public byte[] asBinary()
public boolean isInfMin()
public boolean isInfMax()
public static PrimaryKeyValue fromColumn(ColumnValue value)
public int compareTo(PrimaryKeyValue target)
注意:不同类型的主键列无法比较。
INF_MIN
和INF_MAX
可以与其他类型的主键列进行比较,
并且INF_MIN
比任何类型的主键列值小,INF_MAX
比任何类型的主键列值大。
compareTo
在接口中 Comparable<PrimaryKeyValue>
target
- Copyright © 2016. All Rights Reserved.