Package org.eclipse.ecf.core.identity
Class BaseID
- java.lang.Object
-
- org.eclipse.ecf.core.identity.BaseID
-
- All Implemented Interfaces:
Serializable
,Comparable
,Principal
,org.eclipse.core.runtime.IAdaptable
,ID
- Direct Known Subclasses:
FileTransferID
,LongID
,R_OSGiID
,RemoteServiceID
,ServiceID
,ServiceTypeID
,StringID
,URIID
,UuID
,ZooDiscoveryTargetID
public abstract class BaseID extends Object implements ID
Base class for ID implementation classes Extensions for the org.eclipse.ecf.namespace extension point that expose new Namespace subclasses and their own ID implementations are recommended (but not required) to use this class as a superclass.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object o)
boolean
equals(Object o)
Object
getAdapter(Class clazz)
String
getName()
Get the unique name of this identity.Namespace
getNamespace()
Get the Namespace instance associated with this identityint
hashCode()
protected abstract int
namespaceCompareTo(BaseID o)
protected abstract boolean
namespaceEquals(BaseID o)
Called byNamespace.testIDEquals(BaseID, BaseID)
.protected abstract String
namespaceGetName()
Called byNamespace.getNameForID(BaseID)
.protected abstract int
namespaceHashCode()
Called byNamespace.getHashCodeForID(BaseID)
.protected String
namespaceToExternalForm()
Called byNamespace.toExternalForm(BaseID)
.String
toExternalForm()
Get this ID instance in String form.
-
-
-
Field Detail
-
namespace
protected Namespace namespace
-
-
Constructor Detail
-
BaseID
public BaseID()
- Since:
- 3.9
-
BaseID
protected BaseID(Namespace namespace)
-
-
Method Detail
-
compareTo
public int compareTo(Object o)
- Specified by:
compareTo
in interfaceComparable
-
equals
public boolean equals(Object o)
-
getName
public String getName()
Description copied from interface:ID
Get the unique name of this identity.
-
getNamespace
public Namespace getNamespace()
Description copied from interface:ID
Get the Namespace instance associated with this identity- Specified by:
getNamespace
in interfaceID
- Returns:
- Namespace the Namespace corresponding to this identity. Will not return null.
-
hashCode
public int hashCode()
-
toExternalForm
public String toExternalForm()
Description copied from interface:ID
Get this ID instance in String form. Will not return null.- Specified by:
toExternalForm
in interfaceID
- Returns:
- String that is external representation of this ID
-
namespaceCompareTo
protected abstract int namespaceCompareTo(BaseID o)
- Parameters:
o
- the other ID to compare to. Will not benull
.- Returns:
- the appropriate value as per
Comparable
contract.
-
namespaceEquals
protected abstract boolean namespaceEquals(BaseID o)
Called byNamespace.testIDEquals(BaseID, BaseID)
.- Parameters:
o
- the other ID to test against. May benull
.- Returns:
true
if this ID is equal to the given ID.false
otherwise.
-
namespaceGetName
protected abstract String namespaceGetName()
Called byNamespace.getNameForID(BaseID)
.- Returns:
- String name for this ID. Must not be
null
. Value returned should be unique within this Namespace.
-
namespaceHashCode
protected abstract int namespaceHashCode()
Called byNamespace.getHashCodeForID(BaseID)
.- Returns:
- int hashCode for this ID. Returned value must be unique within this process.
-
namespaceToExternalForm
protected String namespaceToExternalForm()
Called byNamespace.toExternalForm(BaseID)
.- Returns:
- String that represents this ID. Default implementation is to return
namespace.getScheme() + Namespace.SCHEME_SEPARATOR + namespaceGetName();
-
-