Class DatastoreUniqueLongId

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable, DatastoreId

    public class DatastoreUniqueLongId
    extends java.lang.Object
    implements java.io.Serializable, DatastoreId, java.lang.Comparable
    Identity for use with datastore-identity where the datastore provides a unique "identity" long key per object and hence doesn't need the class name. The behaviour of this class is governed by JDO spec 5.4.3.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      long key  
      private static long serialVersionUID  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(java.lang.Object o)  
      boolean equals​(java.lang.Object obj)  
      long getKey()  
      java.lang.Object getKeyAsObject()
      Provides the identity in a form that can be used by the database as a key.
      java.lang.String getTargetClassName()
      Accessor for the target class name for the persistable object this represents.
      int hashCode()  
      java.lang.String toString()
      Creates a String representation of the datastore identity, formed from the key value.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • key

        public final long key
    • Constructor Detail

      • DatastoreUniqueLongId

        public DatastoreUniqueLongId()
      • DatastoreUniqueLongId

        public DatastoreUniqueLongId​(long key)
      • DatastoreUniqueLongId

        public DatastoreUniqueLongId​(java.lang.String str)
                              throws java.lang.IllegalArgumentException
        Constructs an OID from its string representation that is consistent with the output of toString().
        Parameters:
        str - the string representation of an OID
        Throws:
        java.lang.IllegalArgumentException - if the given string representation is not valid.
        See Also:
        toString()
    • Method Detail

      • getKeyAsObject

        public java.lang.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
      • getKey

        public long getKey()
      • getTargetClassName

        public java.lang.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​(java.lang.Object obj)
        Specified by:
        equals in interface DatastoreId
        Overrides:
        equals in class java.lang.Object
      • compareTo

        public int compareTo​(java.lang.Object o)
        Specified by:
        compareTo in interface java.lang.Comparable
      • hashCode

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

        public java.lang.String toString()
        Creates a String representation of the datastore identity, formed from the key value. This will be something like
        3254
        Specified by:
        toString in interface DatastoreId
        Overrides:
        toString in class java.lang.Object
        Returns:
        The String form of the identity