Record Class SzRecordKey

java.lang.Object
java.lang.Record
com.senzing.sdk.SzRecordKey
Record Components:
dataSourceCode - The non-null String data source code identifying the data source of the record.
recordId - The non-null String 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 Details

    • SzRecordKey

      public SzRecordKey(String dataSourceCode, String recordId)
      Constructs with the specified data source code and record ID. This will throw a NullPointerException if either parameter is null and throw IllegalArgumentException if either parameter is empty-string or only contains whitespace.
      Parameters:
      dataSourceCode - The non-null String data source code identifying the data source of the record.
      recordId - The non-null String record ID identifying the record within the data source.
  • Method Details

    • of

      public static SzRecordKey of(String dataSourceCode, String recordId) throws NullPointerException, IllegalArgumentException
      Shorthand static for constructing a new instance of SzRecordKey with the specified data source code and record ID. The specified data source code and record ID must not be null and must each contain at least one character that is not whitespace or else an exception is thrown.
      Parameters:
      dataSourceCode - The non-null String data source code identifying the data source of the record.
      recordId - The non-null String record ID identifying the record within the data source.
      Returns:
      The constructed SzRecordKey.
      Throws:
      NullPointerException - If either parameter is null.
      IllegalArgumentException - If either parameter is empty-string or only contains whitespace.
    • compareTo

      public int compareTo(SzRecordKey recordKey)
      Implemented to sort SzRecordKey instances first on data source code and then on record ID. This is a null-friendly comparison that sorts null values firsdt.
      Specified by:
      compareTo in interface Comparable<SzRecordKey>
      Parameters:
      recordKey - The SzRecordKey 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

      public String toString()
      Returns a brief String representation of this record class. This formats the data source code and record ID with a colon character in between them.
      Specified by:
      toString in class Record
      Returns:
      A brief String representation of this class.
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • dataSourceCode

      public String dataSourceCode()
      Returns the value of the dataSourceCode record component.
      Returns:
      the value of the dataSourceCode record component
    • recordId

      public String recordId()
      Returns the value of the recordId record component.
      Returns:
      the value of the recordId record component