public class PrimaryKey extends Object implements Comparable<PrimaryKey>, Jsonizable, Measurable
PrimaryKey),
which is composed of multiple primary key columns (PrimaryKeyColumn).
Each primary key column includes the name of the primary key column and the value of the primary key column (PrimaryKeyValue).
The number of primary key columns included in the primary key and their order are consistent with what is defined in the TableMeta when creating the table.
| 构造器和说明 |
|---|
PrimaryKey()
internal use
|
PrimaryKey(List<PrimaryKeyColumn> primaryKey)
Constructor.
|
PrimaryKey(PrimaryKeyColumn[] primaryKey)
Constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
compareTo(PrimaryKey target)
Compare two primary keys.
|
boolean |
contains(String name)
Check if the primary key contains a primary key column with this name.
|
boolean |
equals(Object o) |
int |
getDataSize()
Get the total data size of the row primary key, which includes the names and values of all primary key columns.
|
PrimaryKeyColumn |
getPrimaryKeyColumn(int index)
Get the corresponding primary key column by position.
|
PrimaryKeyColumn |
getPrimaryKeyColumn(String name)
Get the primary key column of a specified name.
|
PrimaryKeyColumn[] |
getPrimaryKeyColumns()
Get all the primary key columns.
|
Map<String,PrimaryKeyColumn> |
getPrimaryKeyColumnsMap()
Get the Map of primary key column names to primary key columns.
|
int |
getSize()
已过时。
|
int |
hashCode() |
boolean |
isEmpty()
Checks if the primary key is empty, meaning it does not contain any primary key columns.
|
String |
jsonize() |
void |
jsonize(StringBuilder sb,
String newline) |
int |
size()
Returns the number of primary key columns.
|
String |
toString() |
public PrimaryKey(PrimaryKeyColumn[] primaryKey)
The primary key column array passed in must not be a null pointer. The number of primary key columns and their order in the array must be consistent with what was defined in the TableMeta when the table was created.
primaryKey - All the primary key columns included in this primary keypublic PrimaryKey(List<PrimaryKeyColumn> primaryKey)
The primary key column list passed in must not be a null pointer. The number of primary key columns and their order in the list must match the definition in TableMeta when the table was created.
primaryKey - public PrimaryKey()
public PrimaryKeyColumn getPrimaryKeyColumn(String name)
Returns null if the primary key column with the specified name is not found.
If the list of primary key columns passed during initialization contains primary key columns with the same name, it is not guaranteed which specific primary key column value corresponding to the name will be returned.
name - The name of the primary key columnpublic PrimaryKeyColumn getPrimaryKeyColumn(int index)
The number of primary key columns included in the primary key and the order of the primary key columns are consistent with what is defined in TableMeta when creating the table.
If the corresponding position does not exist, an IllegalArgumentException will be thrown.
index - The position of the primary key columnpublic PrimaryKeyColumn[] getPrimaryKeyColumns()
The number of primary key columns included in the primary key and their order are consistent with the definition in TableMeta when creating the table.
public Map<String,PrimaryKeyColumn> getPrimaryKeyColumnsMap()
If the primary key column list passed during initialization contains primary key columns with the same name, only one of these columns will be returned in the resulting Map.
public boolean contains(String name)
name - The name of the primary key columnpublic int size()
public boolean isEmpty()
@Deprecated public int getSize()
public int getDataSize()
getDataSize 在接口中 Measurablepublic int compareTo(PrimaryKey target)
The two primary keys being compared must have the same schema, meaning the number of columns, primary key names, and order must be completely consistent.
compareTo 在接口中 Comparable<PrimaryKey>target - public String jsonize()
jsonize 在接口中 Jsonizablepublic void jsonize(StringBuilder sb, String newline)
jsonize 在接口中 JsonizableCopyright © 2025. All Rights Reserved.