Class BasicIdentity<PK extends Comparable<PK>>

java.lang.Object
net.solarnetwork.dao.BasicIdentity<PK>
All Implemented Interfaces:
Serializable, Comparable<PK>, Identity<PK>
Direct Known Subclasses:
BasicEntity

public class BasicIdentity<PK extends Comparable<PK>> extends Object implements Identity<PK>, Serializable
A basic, immutable implementation of Identity that is also Serializable.
Since:
1.72
Version:
1.0
Author:
matt
See Also:
  • Constructor Details

    • BasicIdentity

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

    • clone

      public BasicIdentity<PK> 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