Class BasicIdentity<PK extends Comparable<PK>>

java.lang.Object
net.solarnetwork.domain.BasicIdentity<PK>
All Implemented Interfaces:
Comparable<PK>, Identity<PK>
Direct Known Subclasses:
BaseLocalizedServiceInfoProvider, BasicLocalizedServiceInfo, GeneralDatum

public class BasicIdentity<PK extends Comparable<PK>> extends Object implements Identity<PK>
A basic, immutable implementation of Identity.
Since:
1.43
Version:
1.0
Author:
matt
  • Constructor Details

    • BasicIdentity

      public BasicIdentity(PK id)
      Constructor.
      Parameters:
      id - the ID to use
  • Method Details

    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Test if two BasicIdentity objects have the same getId() value.
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(PK o)
      Compare based on the id, with null values ordered before non-null values.
      Specified by:
      compareTo in interface Comparable<PK extends Comparable<PK>>
    • getId

      public PK getId()
      Description copied from interface: Identity
      Get the primary identifier of the object
      Specified by:
      getId in interface Identity<PK extends Comparable<PK>>
      Returns:
      the primary identifier