Class BasicIdentifier

  • All Implemented Interfaces:
    ResourceIdentifier

    public class BasicIdentifier
    extends Object
    implements ResourceIdentifier
    A basic implementation of an identifier of a resource in Silverpeas. In this implementation, the identifier of a resource can be made up of two parts: a global identifier that can be get with the asString() method and a local identifier that identifies the resource uniquely only among others resources of the same type.
    Author:
    mmoquillon
    • Constructor Detail

      • BasicIdentifier

        protected BasicIdentifier()
      • BasicIdentifier

        public BasicIdentifier​(String uniqueId)
        Constructs a basic identifier with only the specified String representation of a unique identifier.
        Parameters:
        uniqueId - String representation of an identifier.
      • BasicIdentifier

        public BasicIdentifier​(int localId,
                               String globalId)
        Constructs a basic identifier with both a local identifier and a String representation of a unique identifier.
        Parameters:
        localId - an identifier local to the type of the identified resource.
        globalId - String representation of an identifier.
    • Method Detail

      • asLocalId

        public int asLocalId()
        Gets the local identification value of this identifier if any.
        Returns:
        an integer representing a local identification. -1 if no local identification is carried by this identifier.
      • asString

        public String asString()
        Description copied from interface: ResourceIdentifier
        Gets the value of this identifier as a String.
        Specified by:
        asString in interface ResourceIdentifier
        Returns:
        the String representation of this identifier.
      • isLocalIdDefined

        public boolean isLocalIdDefined()
        Is the local identification value carried by this identifier?
        Returns:
        true if a local identification is defined for this identifier, false otherwise.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object