Package org.silverpeas.core
Class BasicIdentifier
- java.lang.Object
-
- org.silverpeas.core.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 theasString()
method and a local identifier that identifies the resource uniquely only among others resources of the same type.- Author:
- mmoquillon
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BasicIdentifier()
BasicIdentifier(int localId, String globalId)
Constructs a basic identifier with both a local identifier and a String representation of a unique identifier.BasicIdentifier(String uniqueId)
Constructs a basic identifier with only the specified String representation of a unique identifier.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
asLocalId()
Gets the local identification value of this identifier if any.String
asString()
Gets the value of this identifier as a String.boolean
equals(Object obj)
int
hashCode()
boolean
isLocalIdDefined()
Is the local identification value carried by this identifier?
-
-
-
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 interfaceResourceIdentifier
- 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.
-
-