Package org.eclipse.ecf.core.identity

# Class StringID

java.lang.Object
org.eclipse.ecf.core.identity.BaseID
org.eclipse.ecf.core.identity.StringID

All Implemented Interfaces:
  `Serializable`, `Comparable`, `Principal`, `org.eclipse.core.runtime.IAdaptable`, `ID`

Direct Known Subclasses:
  `GUID`

public class StringID extends BaseID
A string-based identity

See Also:
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`StringID.StringIDNamespace`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected String`
`value`

### Fields inherited from class org.eclipse.ecf.core.identity.BaseID

`namespace`

## Constructor Summary

Constructors
Modifier
Constructor
Description
``
`StringID()`
`protected`
`StringID(Namespace n, String s)`
Protected constructor for factory-based construction

## Method Summary

Modifier and Type
Method
Description
`int`
`compareTo(Object o)`
`boolean`
`equals(Object o)`
`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 String`
`namespaceGetName()`
Called by `Namespace.getNameForID(BaseID)`.
`protected int`
`namespaceHashCode()`
Called by `Namespace.getHashCodeForID(BaseID)`.
`protected void`
`setEmptyNamespace()`
`String`
`toExternalForm()`
Get this ID instance in String form.
`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`

### Methods inherited from interface java.security.Principal

`implies`

## Field Details

### value

protected String value

## Constructor Details

### StringID

public StringID()

Since:
  3.9

### StringID

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

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

## Method Details

### compareTo

public int compareTo(Object o)

Specified by:
  `compareTo` in interface `Comparable`
Overrides:
  `compareTo` in class `BaseID`

### equals

public boolean equals(Object o)

Specified by:
  `equals` in interface `ID`
Specified by:
  `equals` in interface `Principal`
Overrides:
  `equals` in class `BaseID`

### getName

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

Specified by:
  `getName` in interface `ID`
Specified by:
  `getName` in interface `Principal`
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 `ID`
Specified by:
  `hashCode` in interface `Principal`
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 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 String toString()

Specified by:
  `toString` in interface `Principal`
Overrides:
  `toString` in class `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 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()