@API(value=MAINTAINED) public class RecordType extends Object implements RecordTypeOrBuilder, RecordMetaDataProvider
Descriptors.Descriptor
and specifies a primary key expression and any number of secondary Index
es.Constructor and Description |
---|
RecordType(RecordMetaData metaData,
Descriptors.Descriptor descriptor,
KeyExpression primaryKey,
List<Index> indexes,
List<Index> multiTypeIndexes,
Integer sinceVersion,
Object recordTypeKey) |
Modifier and Type | Method and Description |
---|---|
List<Index> |
getAllIndexes()
Gets the list of all indexes that apply for this type.
|
Descriptors.Descriptor |
getDescriptor()
Get the descriptor of the underlying message type.
|
Object |
getExplicitRecordTypeKey()
Get any explicit record type key value.
|
List<Index> |
getIndexes()
Get the list of indexes that are on this record and only this record.
|
List<Index> |
getMultiTypeIndexes()
The Indexes that this record type is on that also contain other record types.
|
String |
getName()
Get the name of the record type.
|
KeyExpression |
getPrimaryKey()
Gets the primary key expression for this record type.
|
RecordMetaData |
getRecordMetaData()
Get the meta-data of which this record type is a part.
|
Object |
getRecordTypeKey()
Gets the
Tuple element value that will be used by RecordTypeKeyExpression for this record type. |
Tuple |
getRecordTypeKeyTuple()
Get a
Tuple containing only the record type key. |
Integer |
getSinceVersion()
Gets a metadata version, which shows when this record type got introduced in the metadata.
|
boolean |
hasExplicitRecordTypeKey()
Get whether this record type sets an explicit value for
getRecordTypeKey() . |
boolean |
isSynthetic()
Get whether this record type represents synthetic records.
|
boolean |
primaryKeyHasRecordTypePrefix()
Determine whether this record type has a
RecordTypeKeyExpression prefix in the primary key. |
String |
toString() |
@Nonnull public String getName()
RecordTypeOrBuilder
getName
in interface RecordTypeOrBuilder
@Nonnull public Descriptors.Descriptor getDescriptor()
RecordTypeOrBuilder
getDescriptor
in interface RecordTypeOrBuilder
@Nonnull public List<Index> getIndexes()
RecordTypeOrBuilder
getIndexes
in interface RecordTypeOrBuilder
@Nonnull public List<Index> getMultiTypeIndexes()
getMultiTypeIndexes
in interface RecordTypeOrBuilder
@Nonnull public List<Index> getAllIndexes()
getIndexes()
,
getMultiTypeIndexes()
,
RecordMetaData.getUniversalIndexes()
@Nonnull public KeyExpression getPrimaryKey()
RecordTypeOrBuilder
getPrimaryKey
in interface RecordTypeOrBuilder
@Nullable public Integer getSinceVersion()
RecordTypeOrBuilder
getSinceVersion
in interface RecordTypeOrBuilder
null
if this information is not available)public boolean hasExplicitRecordTypeKey()
getRecordTypeKey()
.
If there is no explicit value, then #getRecordTypeKey
will use the union message field number.@Nullable public Object getExplicitRecordTypeKey()
null
if getRecordTypeKey()
would return a union field number@Nonnull public Object getRecordTypeKey()
Tuple
element value that will be used by RecordTypeKeyExpression
for this record type.
The value should be unique among record types and stable in the face of meta-data changes.
This value is not guaranteed to be Tuple
-encodable. It is guaranteed that the value returned
has implemented equals()
and hashCode()
so that the
value can be used in hash-based data structures like HashMap
s or
HashSet
s. If the value is needed to construct a Tuple
or Subspace
,
one should call getRecordTypeKeyTuple()
.
getRecordTypeKey
in interface RecordTypeOrBuilder
@Nonnull public Tuple getRecordTypeKeyTuple()
Tuple
containing only the record type key. The record type
key is not generally required to be Tuple
-encodable, so for some record type keys, the following
might throw an error:
Tuple.from(recordType.getRecordTypeKey()).pack()
This function will first convert the record type key into a type that the Tuple
layer can encode
before returning the Tuple
to the user. This method should therefore be preferred over calling
getRecordTypeKey()
when this key is about to be used to read or write data from the database.
Tuple
containing the record type keypublic boolean primaryKeyHasRecordTypePrefix()
RecordTypeKeyExpression
prefix in the primary key.true
if start of the primary key is the unique record type key@Nonnull public RecordMetaData getRecordMetaData()
getRecordMetaData
in interface RecordMetaDataProvider
@API(value=EXPERIMENTAL) public boolean isSynthetic()
true
if this record type represents synthetic records, false
if it represents records that are actually stored