Class BasePK

java.lang.Object
net.solarnetwork.central.domain.BasePK
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
KeyTypePK, LongIntegerCompositePK, LongStringCompositePK, UserLongCompositePK, UserLongIntegerCompositePK, UserLongStringCompositePK, UserStringCompositePK, UserUuidIntegerCompositePK, UserUuidLongCompositePK, UserUuidPK

public abstract class BasePK extends Object implements Serializable, Cloneable
Base class for primary key values.
Since:
1.39
See Also:
  • Constructor Details

    • BasePK

      public BasePK()
  • Method Details

    • populateIdValue

      protected abstract void populateIdValue(StringBuilder buf)
      Populate a string builder with an ID value.

      This method is called from getId().

      Parameters:
      buf - the buffer to populate
    • getId

      public final String getId()
      Get a computed string ID value for this primary key.

      Note this value is derived from the properties of this class, and not assigned by the system. This method calls populateIdValue(StringBuilder) and then computes a hex-encoded SHA1 value from that as the final ID value.

      Returns:
      computed ID string
    • populateStringValue

      protected abstract void populateStringValue(StringBuilder buf)
      Populate a string builder with a friendly string value.

      This method is called from toString(). The buffer will be initially empty when invoked.

      Parameters:
      buf - the buffer to populate
    • toString

      public final String toString()
      Generate a string value.

      This method generates a string like Class{data} where data is generated via populateStringValue(StringBuilder).

      Overrides:
      toString in class Object
    • clone

      protected BasePK clone()
      Overrides:
      clone in class Object