Interface ID

  • All Superinterfaces:
    java.lang.Cloneable, java.lang.Comparable<java.lang.Object>
    All Known Implementing Classes:
    CoordinateID, Date, EntityID, EresseaDate, IntegerID, LongID, SimpleDate, StringID, UnitID

    public interface ID
    extends java.lang.Comparable<java.lang.Object>, java.lang.Cloneable
    A general interface to ID objects conveying "uniqueness". IDs should be (but are not required to be) immutable after construction.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Returns a copy of this object.
      int compareTo​(java.lang.Object o)
      Imposes a natural ordering on ID objects.
      boolean equals​(java.lang.Object obj)
      Compares this object to the specified object.
      int hashCode()
      Returns a hashcode for this ID.
      java.lang.String toString()
      Returns a String representation of the ID formatted in a user friendly manner.
      java.lang.String toString​(java.lang.String delim)
      Returns a String representation of the ID formatted in a user friendly manner with a given separator.
    • Method Detail

      • toString

        java.lang.String toString()
        Returns a String representation of the ID formatted in a user friendly manner.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String representation of the ID formatted in a user friendly manner.
      • toString

        java.lang.String toString​(java.lang.String delim)
        Returns a String representation of the ID formatted in a user friendly manner with a given separator. Right now only Coordinate should implement this, all others should invoke toString()!
        Returns:
        a String representation of the ID formatted in a user friendly manner.
      • equals

        boolean equals​(java.lang.Object obj)
        Compares this object to the specified object. The result is true if and only if the argument is not null and is an object of the same class implementing this interface and contains the same unique value.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.
      • hashCode

        int hashCode()
        Returns a hashcode for this ID.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for this object.
      • compareTo

        int compareTo​(java.lang.Object o)
        Imposes a natural ordering on ID objects.
        Specified by:
        compareTo in interface java.lang.Comparable<java.lang.Object>
      • clone

        java.lang.Object clone()
                        throws java.lang.CloneNotSupportedException
        Returns a copy of this object.
        Throws:
        java.lang.CloneNotSupportedException