Class StringId

java.lang.Object
com.saperion.common.lang.id.StringId
All Implemented Interfaces:
Id, Serializable, Comparable<StringId>
Direct Known Subclasses:
HierarchicalName

public class StringId extends Object implements Id, Comparable<StringId>

A simple String-based id.

An instance of StringId can be used in several threads concurrently.

Author:
agz
See Also:
  • Constructor Details

    • StringId

      public StringId(String id)
      Creates a new String-based id.

      The specified id must not be null.

      Parameters:
      id - String-content, the new id is based on
  • Method Details

    • getString

      public final String getString()
      Description copied from interface: Id
      Returns the string-representation of this Id.
      Specified by:
      getString in interface Id
      Returns:
      the string-representation of this Id
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public final int compareTo(StringId id)
      Specified by:
      compareTo in interface Comparable<StringId>
    • toString

      public final String toString()
      This toString()-method returns a full representation of a StringId which is compatible with the constructor. So this toString()-method is usable in business-logic and not only for debugging purposes.
      Overrides:
      toString in class Object