Class VersionedId

  • All Implemented Interfaces:
    IVersionedId

    public class VersionedId
    extends java.lang.Object
    implements IVersionedId
    An object representing a (id,version) pair. An instance of this class can be constructed by invoking the constructor or calling parse(String) with a string representation of this VersionedID.
    Since:
    2.0
    Restriction:
    This class is not intended to be subclassed by clients.
    • Constructor Summary

      Constructors 
      Constructor Description
      VersionedId​(java.lang.String id, java.lang.String version)
      Creates a new versioned id with the given id and version.
      VersionedId​(java.lang.String id, Version version)
      Creates a new versioned id with the given id and version.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.String getId()
      Returns the id portion of this versioned id.
      Version getVersion()
      Returns the version portion of this versioned id.
      int hashCode()  
      static IVersionedId parse​(java.lang.String spec)
      Creates and returns a new VersionedId from the given string specification.
      java.lang.String toString()
      Returns a string representation of this versioned id.
      • Methods inherited from class java.lang.Object

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

      • VersionedId

        public VersionedId​(java.lang.String id,
                           java.lang.String version)
        Creates a new versioned id with the given id and version.
        Parameters:
        id - The identifier
        version - The version
        Throws:
        java.lang.IllegalArgumentException - If version is improperly formatted.
      • VersionedId

        public VersionedId​(java.lang.String id,
                           Version version)
        Creates a new versioned id with the given id and version.
        Parameters:
        id - The identifier
        version - The version
    • Method Detail

      • parse

        public static IVersionedId parse​(java.lang.String spec)
        Creates and returns a new VersionedId from the given string specification. The specification must be of the form "id/version", or just "id" if the version is absent

        This factory method can be used to reconstruct a VersionedId instance from the string representation produced by a previous invocation of toString().

        Parameters:
        spec - the specification for the versioned id to create
        Returns:
        the parsed versioned id
        Throws:
        java.lang.IllegalArgumentException - If spec is improperly formatted.
      • getId

        public java.lang.String getId()
        Description copied from interface: IVersionedId
        Returns the id portion of this versioned id.
        Specified by:
        getId in interface IVersionedId
        Returns:
        the ID of this VersionedID
      • getVersion

        public Version getVersion()
        Description copied from interface: IVersionedId
        Returns the version portion of this versioned id.
        Specified by:
        getVersion in interface IVersionedId
        Returns:
        the Version of this VersionedID
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Returns a string representation of this versioned id. The result can be used to later construct an equal VersionedId instance using {parse(String).
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of this versioned id