org.eclipse.ecf.core.identity
Class StringID

java.lang.Object
  extended by org.eclipse.ecf.core.identity.BaseID
      extended by org.eclipse.ecf.core.identity.StringID
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, java.security.Principal, org.eclipse.core.runtime.IAdaptable, ID
Direct Known Subclasses:
GUID, LocalID, RSExampleID, TrivialID

public class StringID
extends BaseID

A string-based identity

See Also:
Serialized Form

Nested Class Summary
static class StringID.StringIDNamespace
           
 
Field Summary
protected  java.lang.String value
           
 
Fields inherited from class org.eclipse.ecf.core.identity.BaseID
namespace
 
Constructor Summary
protected StringID(Namespace n, java.lang.String s)
          Protected constructor for factory-based construction
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getName()
          Get the unique name of this identity.
 Namespace getNamespace()
          Get the Namespace instance associated with this identity
 int hashCode()
           
protected  int namespaceCompareTo(BaseID obj)
          Called by Namespace.getCompareToForObject(BaseID, BaseID).
protected  boolean namespaceEquals(BaseID obj)
          Called by Namespace.testIDEquals(BaseID, BaseID).
protected  java.lang.String namespaceGetName()
          Called by Namespace.getNameForID(BaseID).
protected  int namespaceHashCode()
          Called by Namespace.getHashCodeForID(BaseID).
protected  void setEmptyNamespace()
           
 java.lang.String toExternalForm()
          Get this ID instance in String form.
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.ecf.core.identity.BaseID
getAdapter, namespaceToExternalForm
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected java.lang.String value
Constructor Detail

StringID

protected StringID(Namespace n,
                   java.lang.String s)
Protected constructor for factory-based construction

Parameters:
n - the Namespace this identity will belong to
s - the String defining this StringID
Method Detail

compareTo

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

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 BaseID

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
Overrides:
getName in class BaseID
Returns:
String unique name for this identity. Will not be null, and must be a unique String within the Namespace returned by getNamespace()

hashCode

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

getNamespace

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

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

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
Overrides:
toExternalForm in class BaseID
Returns:
String that is external representation of this ID

toString

public java.lang.String toString()
Specified by:
toString in interface java.security.Principal
Overrides:
toString in class java.lang.Object

namespaceCompareTo

protected int namespaceCompareTo(BaseID obj)
Description copied from class: BaseID
Called by Namespace.getCompareToForObject(BaseID, BaseID).

Specified by:
namespaceCompareTo in class BaseID
Parameters:
obj - the other ID to compare to. Will not be null.
Returns:
the appropriate value as per Comparable contract.

namespaceEquals

protected boolean namespaceEquals(BaseID obj)
Description copied from class: BaseID
Called by Namespace.testIDEquals(BaseID, BaseID).

Specified by:
namespaceEquals in class BaseID
Parameters:
obj - the other ID to test against. May be null.
Returns:
true if this ID is equal to the given ID. false otherwise.

namespaceGetName

protected java.lang.String namespaceGetName()
Description copied from class: BaseID
Called by Namespace.getNameForID(BaseID).

Specified by:
namespaceGetName in class BaseID
Returns:
String name for this ID. Must not be null. Value returned should be unique within this Namespace.

namespaceHashCode

protected int namespaceHashCode()
Description copied from class: BaseID
Called by Namespace.getHashCodeForID(BaseID).

Specified by:
namespaceHashCode in class BaseID
Returns:
int hashCode for this ID. Returned value must be unique within this process.

setEmptyNamespace

protected void setEmptyNamespace()