# com.bea.content
ID Class

public class ID
extends `Object`
implements `Serializable`

The ID of a content element. The id includes the name of the Repository where it resides and also the unique id given by the repository.

Hierarchy
  `Object`
  `ID`

All Implemented Interfaces
  `Serializable`

## Constructor Summary

ID() Empty constructor.
ID(`String` repositoryName, `String` uid) Constructor with repositoryName and uid.
ID(`String` uid) Constructor with just the id.

## Method Summary

`public boolean` | `equals`(`Object` o) Checks equality.
`public static `ID`` | `fromString`(`String` id) Parses an id in path format and creates an ID instance from it.
`public `String`` | `getRepositoryName`() Gets the name of the repository where the content element resides.
`public `String`` | `getUid`() Gets the repository unique id for the content element.
`public int` | `hashCode`()
`public boolean` | `hasUid`() Returns true if the id is not null and not an empty String.
`public void` | `setRepositoryName`(`String` repositoryName) Sets the name of the repository where the content element resides.
`public void` | `setUid`(`String` uid) Sets the repository unique id for the content element.
`public `String`` | `toString`() Returns ID in unix-path like format.

Methods from class `java.lang.`Object``
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Detail

### ID

    public ID()

  Empty constructor.

### ID

    public ID(String repositoryName,
              String uid)

  Constructor with repositoryName and uid. When creating a ContentEntity, such as a Node, the repositoryName must be set, but the uid would be null (since it hasn't been created yet).

### ID

    public ID(String uid)

  Constructor with just the id. Most useful for an SPI implementation where the uid is known, but not the repositoryName as it will be set by the management layer.

## Method Detail

### equals(Object) Method

    public boolean equals(Object o)

Checks equality. O is equal to this if the repositoryName and the uid are equal.

Overrides
  `Object.equals(Object)`

#### Parameters

o
  the object to check equality on.

#### Returns

true if o is equal to this, false otherwise.

### fromString(String) Method

    public static ID fromString(String id)

Parses an id in path format and creates an ID instance from it. Below are valid example combinations.
- /repo/123 - repositoryName will be "repo" and uid will be "123"
- /repo - repositoryName will be "repo" and uid will be an empty string.
- repo - repositoryName will be "repo" and uid will be an empty string.

  #### Parameters

  id
    in the format /repository/uid

  #### Returns

  ID the new ID.

  ### getRepositoryName() Method

      public String getRepositoryName()

  Gets the name of the repository where the content element resides.

  ### getUid() Method

      public String getUid()

  Gets the repository unique id for the content element.

  ### hashCode() Method

      public int hashCode()

  Overrides
    `Object.hashCode()`

  ### hasUid() Method

      public boolean hasUid()

  Returns true if the id is not null and not an empty String.

  ### setRepositoryName(String) Method

      public void setRepositoryName(String repositoryName)

  Sets the name of the repository where the content element resides.

  ### setUid(String) Method

      public void setUid(String uid)

  Sets the repository unique id for the content element.

  ### toString() Method

      public String toString()

  Returns ID in unix-path like format. For example, an ID with repositoryName = "Repo" and uid = "123" would be returned as "/Repo/123".

  Overrides
    `Object.toString()`