All Known Implementing Classes:
LocalId

public interface ILocalId
Local (in-context) object identification (local id). Sole implementation of this interface is LocalId.

Local id consists of prototype name, (optional) container id, object name and (optional) revision.

Local id can be represented as "normalized" string with exact format: left curly bracket ('{'), prototype name, right curly bracket ('}'), if there is container id then follows normalized container id and numbersign ('#'), next is object name and if there is revision then follows percent sign ('%') and revision.

Examples:

   {prototype_name}container_id#object_name%revision
   {prototype_name}object_name
 

Each part of local id should consist only of English characters, period and hyphen/minus: .-0-9A-Za-z.

Object names may be optionally prefixed with asterisk ('*'). Such names are "temporary" which means that objects will not retain these names for long. As such they should not be referenced nor used unless user knows what s/he's doing.

There is also "prototype-less normalized" string representation of local id. It is used when user thinks he can infer prototype names when needed (inner container ids are also represented as prototype-less normalized strings). The only difference between this and format described above is that it does not have curly brackets and prototype name. However local id itself must always contain prototype name. Implementations of this class must be immutable.

Version:
$Revision$ $Date$
Author:
Stepan Roh, Polarion Software
  • Field Details

    • PROTOTYPE_START_DELIM

      static final String PROTOTYPE_START_DELIM
      Delimiter between start of the string and prototype name in normalized string representation.
      See Also:
    • PROTOTYPE_START_DELIM_CHAR

      static final char PROTOTYPE_START_DELIM_CHAR
      Delimiter between start of the string and prototype name in normalized string representation.
      See Also:
    • PROTOTYPE_END_DELIM

      static final String PROTOTYPE_END_DELIM
      Delimiter between prototype name and rest of the string in normalized string representation.
      See Also:
    • PROTOTYPE_END_DELIM_CHAR

      static final char PROTOTYPE_END_DELIM_CHAR
      Delimiter between prototype name and rest of the string in normalized string representation.
      See Also:
    • CONTAINER_DELIM

      static final String CONTAINER_DELIM
      Delimiter between container id and object name in normalized string representation.
      See Also:
    • CONTAINER_DELIM_CHAR

      static final char CONTAINER_DELIM_CHAR
      Delimiter between container id and object name in normalized string representation.
      See Also:
    • REVISION_DELIM

      static final String REVISION_DELIM
      Delimiter between object name and revision in normalized string representation.
      See Also:
    • REVISION_DELIM_CHAR

      static final char REVISION_DELIM_CHAR
      Delimiter between object name and revision in normalized string representation.
      See Also:
    • TEMPORARY_OBJECT_NAME_PREFIX

      static final String TEMPORARY_OBJECT_NAME_PREFIX
      "Temporary" object name prefix.
      See Also:
    • TEMPORARY_OBJECT_NAME_PREFIX_CHAR

      static final char TEMPORARY_OBJECT_NAME_PREFIX_CHAR
      "Temporary" object name prefix.
      See Also:
  • Method Details

    • getPrototypeName

      String getPrototypeName()
      Prototype name.
      Returns:
      prototype name
    • getContainerId

      ILocalId getContainerId()
      Container id (if any).
      Returns:
      local id of container or null
    • getObjectName

      String getObjectName()
      Object name.
      Returns:
      object name
    • setObjectName

      ILocalId setObjectName(String objectName)
      Set object name of this local id and return new local id.
      Parameters:
      objectName - object name
      Returns:
      new local id
      Throws:
      IllegalArgumentException - if objectName is null
    • getRevision

      String getRevision()
      Revision (if any).
      Returns:
      object revision or null
    • removeRevision

      ILocalId removeRevision()
      Remove revision from this local id and return new local id.
      Returns:
      new local id
    • setRevision

      ILocalId setRevision(String revision)
      Set revision of this local id and return new local id.
      Parameters:
      revision - If null, then returns local id without revision (same as removeRevision()).
      Returns:
      new local id
    • isTemporary

      boolean isTemporary()
      Whether this local id is temporary (its object name has temporary prefix).
      Returns:
      true if this local id is temporary
    • toNormalizedString

      String toNormalizedString()
      Return normalized string representation of this local id.
      Returns:
      normalized string
    • toPrototypeLessNormalizedString

      String toPrototypeLessNormalizedString()
      Return prototype-less normalized string representation of this local id.
      Returns:
      normalized string