Interface ILocalId
- All Known Implementing Classes:
LocalId
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 Summary
Modifier and TypeFieldDescriptionstatic final String
Delimiter between container id and object name in normalized string representation.static final char
Delimiter between container id and object name in normalized string representation.static final String
Delimiter between prototype name and rest of the string in normalized string representation.static final char
Delimiter between prototype name and rest of the string in normalized string representation.static final String
Delimiter between start of the string and prototype name in normalized string representation.static final char
Delimiter between start of the string and prototype name in normalized string representation.static final String
Delimiter between object name and revision in normalized string representation.static final char
Delimiter between object name and revision in normalized string representation.static final String
"Temporary" object name prefix.static final char
"Temporary" object name prefix. -
Method Summary
Modifier and TypeMethodDescriptionContainer id (if any).Object name.Prototype name.Revision (if any).boolean
Whether this local id is temporary (its object name has temporary prefix).Remove revision from this local id and return new local id.setObjectName
(String objectName) Set object name of this local id and return new local id.setRevision
(String revision) Set revision of this local id and return new local id.Return normalized string representation of this local id.Return prototype-less normalized string representation of this local id.
-
Field Details
-
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_CHARDelimiter between start of the string and prototype name in normalized string representation.- See Also:
-
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_CHARDelimiter between prototype name and rest of the string in normalized string representation.- See Also:
-
CONTAINER_DELIM
Delimiter between container id and object name in normalized string representation.- See Also:
-
CONTAINER_DELIM_CHAR
static final char CONTAINER_DELIM_CHARDelimiter between container id and object name in normalized string representation.- See Also:
-
REVISION_DELIM
Delimiter between object name and revision in normalized string representation.- See Also:
-
REVISION_DELIM_CHAR
static final char REVISION_DELIM_CHARDelimiter between object name and revision in normalized string representation.- See Also:
-
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
Set object name of this local id and return new local id.- Parameters:
objectName
- object name- Returns:
- new local id
- Throws:
IllegalArgumentException
- if objectName isnull
-
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
Set revision of this local id and return new local id.- Parameters:
revision
- Ifnull
, then returns local id without revision (same asremoveRevision()
).- 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
-