Package com.orchestranetworks.instance

# Class HomeKey

java.lang.Object
com.orchestranetworks.instance.HomeKey

Direct Known Subclasses:
  `BranchKey`, `VersionKey`

public abstract sealed class HomeKey extends Object permits BranchKey, VersionKey
Abstract superclass for dataspace and snapshot identifiers.

See Also:
  - `Repository.lookupHome(HomeKey)`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `KEY_PATTERN`
  Regular expression that controls the syntax of a dataspace or snapshot key.
  `static final Pattern`
  `KEY_PATTERN_COMPILED`
  The compiled representation of a dataspace or a snapshot key.
  `static final int`
  `MAX_KEY_LENGTH`
  Maximum length of a dataspace or snapshot key: 32.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `equals(Object x)`
  `static final BranchKey`
  `forBranchName(String aName)`
  Returns the dataspace identifier with the specified name.
  `final String`
  `format()`
  Returns a persistent identifier of a dataspace or snapshot.
  `static final VersionKey`
  `forVersionName(String aName)`
  Returns the snapshot identifier with the specified name.
  `final String`
  `getName()`
  Returns the string associated with this key.
  `final int`
  `hashCode()`
  `abstract boolean`
  `isBranch()`
  Returns `true` if this key identifies a dataspace.
  `final boolean`
  `isVersion()`
  Returns `true` if this key identifies a snapshot.
  `static final HomeKey`
  `parse(String aString)`
  Parses the specified string, so as to return either a dataspace or snapshot key.
  `final String`
  `toDisplayString(Locale aLocale)`
  Returns a user-friendly string that specifies the type of this key, for example, "Dataspace <name>" or "Snapshot <name>".
  `final String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### MAX_KEY_LENGTH

    public static final int MAX_KEY_LENGTH
    Maximum length of a dataspace or snapshot key: 32.
    See Also:
      - Constant Field Values

  - ### KEY_PATTERN

    public static final String KEY_PATTERN
    Regular expression that controls the syntax of a dataspace or snapshot key. The regular expression is:

    > "[a-zA-Z0-9_:.\\-\\|]*"

    See Also:
      - Constant Field Values

  - ### KEY_PATTERN_COMPILED

    public static final Pattern KEY_PATTERN_COMPILED
    The compiled representation of a dataspace or a snapshot key.
    Since:
      6.0.0
    See Also:
      - `KEY_PATTERN`

- ## Method Details

  - ### forBranchName

    public static final BranchKey forBranchName(String aName)
    Returns the dataspace identifier with the specified name.

  - ### forVersionName

    public static final VersionKey forVersionName(String aName)
    Returns the snapshot identifier with the specified name.

  - ### parse

    public static final HomeKey parse(String aString)
    Parses the specified string, so as to return either a dataspace or snapshot key.

    The specified string must have been generated by `format()`.

    Parameters:
      `aString` - specified string
    Throws:
      `IllegalArgumentException` - If specified string :
      - is undefined,
      - is empty,
      - has an illegal prefix character.
    See Also:
      - `format()`
      - `forVersionName(String)`
      - `forBranchName(String)`

  - ### isBranch

    public abstract boolean isBranch()
    Returns `true` if this key identifies a dataspace.

  - ### isVersion

    public final boolean isVersion()
    Returns `true` if this key identifies a snapshot.

  - ### getName

    public final String getName()
    Returns the string associated with this key.

    Since the dataspace namespace and the snapshot namespace are independent, the returned string is only an identifier in the context of one of the namespaces. For a global dataspace or snapshot identifier, the method `format()` must be used.

    See Also:
      - `format()`

  - ### format

    public final String format()
    Returns a persistent identifier of a dataspace or snapshot.

    Compared to the method `getName()`, this identifier additionally specifies whether this key is for a dataspace or a snapshot.

    See Also:
      - `parse(String)`

  - ### equals

    public final boolean equals(Object x)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public final int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toDisplayString

    public final String toDisplayString(Locale aLocale)
    Returns a user-friendly string that specifies the type of this key, for example, "Dataspace <name>" or "Snapshot <name>".

  - ### toString

    public final String toString()
    Overrides:
      `toString` in class `Object`