Package com.senzing.sdk
Record Class SzRecordKey
java.lang.Object
java.lang.Record
com.senzing.sdk.SzRecordKey
- Record Components:
dataSourceCode- The non-nullStringdata source code identifying the data source of the record.recordId- The non-nullStringrecord 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>
Describes a key for identifying a record as Java record class containing
a data source code and record ID.
- Since:
- 4.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionSzRecordKey(String dataSourceCode, String recordId) Constructs with the specified data source code and record ID. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(SzRecordKey recordKey) Implemented to sortSzRecordKeyinstances first on data source code and then on record ID.Returns the value of thedataSourceCoderecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static SzRecordKeyShorthand static for constructing a new instance ofSzRecordKeywith the specified data source code and record ID.recordId()Returns the value of therecordIdrecord component.toString()Returns a briefStringrepresentation of this record class.
-
Constructor Details
-
SzRecordKey
Constructs with the specified data source code and record ID. This will throw aNullPointerExceptionif either parameter isnulland throwIllegalArgumentExceptionif 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 ofSzRecordKeywith the specified data source code and record ID. The specified data source code and record ID must not benulland must each contain at least one character that is not whitespace or else an exception is thrown.- Parameters:
dataSourceCode- The non-nullStringdata source code identifying the data source of the record.recordId- The non-nullStringrecord 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.- Since:
- 4.0.0
-
compareTo
Implemented to sortSzRecordKeyinstances first on data source code and then on record ID. This is a null-friendly comparison that sortsnullvalues first.- Specified by:
compareToin interfaceComparable<SzRecordKey>- Parameters:
recordKey- TheSzRecordKeyto 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 briefStringrepresentation 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 thedataSourceCoderecord component.- Returns:
- the value of the
dataSourceCoderecord component
-
recordId
Returns the value of therecordIdrecord component.- Returns:
- the value of the
recordIdrecord component
-