org.eclipse.ecf.core.identity
Class BaseID

java.lang.Object
  extended by org.eclipse.ecf.core.identity.BaseID
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, java.security.Principal, org.eclipse.core.runtime.IAdaptable, ID
Direct Known Subclasses:
FileTransferID, LongID, R_OSGiID, RemoteServiceID, ServiceID, ServiceTypeID, StringID, URIID, XMPPFileID, XMPPID, XMPPRoomID, ZooDiscoveryTargetID

public abstract class BaseID
extends java.lang.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

Field Summary
protected  Namespace namespace
           
 
Constructor Summary
protected BaseID()
           
protected BaseID(Namespace namespace)
           
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object o)
           
 java.lang.Object getAdapter(java.lang.Class clazz)
           
 java.lang.String getName()
          Get the unique name of this identity.
 Namespace getNamespace()
          Get the Namespace instance associated with this identity
 int hashCode()
           
protected abstract  int namespaceCompareTo(BaseID o)
          Called by Namespace.getCompareToForObject(BaseID, BaseID).
protected abstract  boolean namespaceEquals(BaseID o)
          Called by Namespace.testIDEquals(BaseID, BaseID).
protected abstract  java.lang.String namespaceGetName()
          Called by Namespace.getNameForID(BaseID).
protected abstract  int namespaceHashCode()
          Called by Namespace.getHashCodeForID(BaseID).
protected  java.lang.String namespaceToExternalForm()
          Called by Namespace.toExternalForm(BaseID).
 java.lang.String toExternalForm()
          Get this ID instance in String form.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Principal
toString
 

Field Detail

namespace

protected Namespace namespace
Constructor Detail

BaseID

protected BaseID()

BaseID

protected BaseID(Namespace namespace)
Method Detail

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.security.Principal
Specified by:
equals in interface ID
Overrides:
equals in class java.lang.Object

getName

public java.lang.String getName()
Description copied from interface: ID
Get the unique name of this identity.

Specified by:
getName in interface java.security.Principal
Specified by:
getName in interface ID
Returns:
String unique name for this identity. Will not be null, and must be a unique String within the Namespace returned by getNamespace()

getNamespace

public Namespace getNamespace()
Description copied from interface: ID
Get the Namespace instance associated with this identity

Specified by:
getNamespace in interface ID
Returns:
Namespace the Namespace corresponding to this identity. Will not return null.

hashCode

public int hashCode()
Specified by:
hashCode in interface java.security.Principal
Specified by:
hashCode in interface ID
Overrides:
hashCode in class java.lang.Object

toExternalForm

public java.lang.String toExternalForm()
Description copied from interface: ID
Get this ID instance in String form. Will not return null.

Specified by:
toExternalForm in interface ID
Returns:
String that is external representation of this ID

namespaceCompareTo

protected abstract int namespaceCompareTo(BaseID o)
Called by Namespace.getCompareToForObject(BaseID, BaseID).

Parameters:
o - the other ID to compare to. Will not be null.
Returns:
the appropriate value as per Comparable contract.

namespaceEquals

protected abstract boolean namespaceEquals(BaseID o)
Called by Namespace.testIDEquals(BaseID, BaseID).

Parameters:
o - the other ID to test against. May be null.
Returns:
true if this ID is equal to the given ID. false otherwise.

namespaceGetName

protected abstract java.lang.String namespaceGetName()
Called by Namespace.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 by Namespace.getHashCodeForID(BaseID).

Returns:
int hashCode for this ID. Returned value must be unique within this process.

namespaceToExternalForm

protected java.lang.String namespaceToExternalForm()
Called by Namespace.toExternalForm(BaseID).

Returns:
String that represents this ID. Default implementation is to return
 namespace.getScheme() + Namespace.SCHEME_SEPARATOR + namespaceGetName();
 

getAdapter

public java.lang.Object getAdapter(java.lang.Class clazz)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable