Class DatastoreIdImpl

java.lang.Object
org.datanucleus.identity.DatastoreIdImpl
All Implemented Interfaces:
Serializable, Comparable, DatastoreId

public class DatastoreIdImpl extends Object implements Serializable, DatastoreId, Comparable
An object identifier, typically used for datastore identity. The behaviour of this class is governed by JDO spec 5.4.3. Utilises a String form of the style "3258[OID]mydomain.MyClass".
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • STRING_DELIMITER

      protected static final transient String STRING_DELIMITER
      See Also:
    • keyAsObject

      public final Object keyAsObject
    • targetClassName

      public final String targetClassName
    • toString

      public final String toString
    • hashCode

      public final int hashCode
  • Constructor Details

    • DatastoreIdImpl

      public DatastoreIdImpl(String pcClass, Object key)
    • DatastoreIdImpl

      public DatastoreIdImpl(String str) throws IllegalArgumentException
      Constructs a DatastoreId from its string representation that is consistent with the output of toString().
      Parameters:
      str - the string representation of a DatastoreId
      Throws:
      IllegalArgumentException - if the given string representation is not valid.
      See Also:
  • Method Details

    • getKeyAsObject

      public Object getKeyAsObject()
      Description copied from interface: DatastoreId
      Provides the identity in a form that can be used by the database as a key.
      Specified by:
      getKeyAsObject in interface DatastoreId
      Returns:
      The key value
    • getTargetClassName

      public String getTargetClassName()
      Description copied from interface: DatastoreId
      Accessor for the target class name for the persistable object this represents.
      Specified by:
      getTargetClassName in interface DatastoreId
      Returns:
      the class name of the persistable
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface DatastoreId
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(Object o)
      Specified by:
      compareTo in interface Comparable
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface DatastoreId
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Creates a String representation of the datastore identity, formed from the target class name and the key value. This will be something like
      3254[OID]mydomain.MyClass
      Specified by:
      toString in interface DatastoreId
      Overrides:
      toString in class Object
      Returns:
      The String form of the identity