Class DatastoreIdImpl

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

    public class DatastoreIdImpl
    extends java.lang.Object
    implements java.io.Serializable, DatastoreId, java.lang.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:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      DatastoreIdImpl​(java.lang.String str)
      Constructs a DatastoreId from its string representation that is consistent with the output of toString().
      DatastoreIdImpl​(java.lang.String pcClass, java.lang.Object key)  
    • 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)  
      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 target class name and the key value.
      • Methods inherited from class java.lang.Object

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

      • STRING_DELIMITER

        protected static final transient java.lang.String STRING_DELIMITER
        See Also:
        Constant Field Values
      • keyAsObject

        public final java.lang.Object keyAsObject
      • targetClassName

        public final java.lang.String targetClassName
      • toString

        public final java.lang.String toString
      • hashCode

        public final int hashCode
    • Constructor Detail

      • DatastoreIdImpl

        public DatastoreIdImpl​(java.lang.String pcClass,
                               java.lang.Object key)
      • DatastoreIdImpl

        public DatastoreIdImpl​(java.lang.String str)
                        throws java.lang.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:
        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
      • 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 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 java.lang.Object
        Returns:
        The String form of the identity