Package com.senzing.sdk
Record Class SzRecordKey
java.lang.Object
java.lang.Record
com.senzing.sdk.SzRecordKey
- Record Components:
dataSourceCode
- The non-nullString
data source code identifying the data source of the record.recordId
- The non-nullString
record ID identifying the record within the data source.
- All Implemented Interfaces:
Comparable<SzRecordKey>
public record SzRecordKey(String dataSourceCode, String recordId)
extends Record
implements Comparable<SzRecordKey>
Desribes a key for identifying a record as Java record class containing
a data source code and record ID.
-
Constructor Summary
ConstructorDescriptionSzRecordKey
(String dataSourceCode, String recordId) Constructs with the specified data source code and record ID. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(SzRecordKey recordKey) Implemented to sortSzRecordKey
instances first on data source code and then on record ID.Returns the value of thedataSourceCode
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.static SzRecordKey
Shorthand static for constructing a new instance ofSzRecordKey
with the specified data source code and record ID.recordId()
Returns the value of therecordId
record component.toString()
Returns a briefString
representation of this record class.
-
Constructor Details
-
SzRecordKey
Constructs with the specified data source code and record ID. This will throw aNullPointerException
if either parameter isnull
and throwIllegalArgumentException
if either parameter is empty-string or only contains whitespace.
-
-
Method Details
-
of
public static SzRecordKey of(String dataSourceCode, String recordId) throws NullPointerException, IllegalArgumentException Shorthand static for constructing a new instance ofSzRecordKey
with the specified data source code and record ID. The specified data source code and record ID must not benull
and must each contain at least one character that is not whitespace or else an exception is thrown.- Parameters:
dataSourceCode
- The non-nullString
data source code identifying the data source of the record.recordId
- The non-nullString
record ID identifying the record within the data source.- Returns:
- The constructed
SzRecordKey
. - Throws:
NullPointerException
- If either parameter isnull
.IllegalArgumentException
- If either parameter is empty-string or only contains whitespace.
-
compareTo
Implemented to sortSzRecordKey
instances first on data source code and then on record ID. This is a null-friendly comparison that sortsnull
values firsdt.- Specified by:
compareTo
in interfaceComparable<SzRecordKey>
- Parameters:
recordKey
- TheSzRecordKey
to compare to.- Returns:
- A negative integer, zero (0) or a positive integer depending on whether this instance sorts less-than, equal-to or greater-than the specified instance, respectively.
-
toString
Returns a briefString
representation of this record class. This formats the data source code and record ID with a colon character in between them. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
dataSourceCode
Returns the value of thedataSourceCode
record component.- Returns:
- the value of the
dataSourceCode
record component
-
recordId
Returns the value of therecordId
record component.- Returns:
- the value of the
recordId
record component
-