Class BaseId

java.lang.Object
net.solarnetwork.domain.BaseId
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
DatumId

public abstract class BaseId extends Object implements Serializable, Cloneable
Base class for primary key values.
Since:
1.71
Version:
1.0
Author:
matt
See Also:
  • Constructor Details

    • BaseId

      public BaseId()
  • 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 Object clone()
      Overrides:
      clone in class Object