Package org.apache.ignite.lang

## Class IgniteUuid

- java.lang.Object
- - org.apache.ignite.lang.IgniteUuid

- All Implemented Interfaces:
    `Externalizable`, `Serializable`, `Cloneable`, `Comparable<IgniteUuid>`, `Iterable<IgniteUuid>`, `Binarylizable`

      public final class IgniteUuid
      extends Object
      implements Comparable<IgniteUuid>, Iterable<IgniteUuid>, Cloneable, Externalizable, Binarylizable

  This is a faster performing version of `UUID`. On basic tests this version is at least 10x time faster for ID creation. It uses extra memory for 8-byte counter additionally to internal UUID.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static UUID` | `VM_ID` | VM ID.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `IgniteUuid()` | Empty constructor required for `Externalizable`.
    `IgniteUuid​(UUID gid, long locId)` | Constructs `IgniteUuid` from a global and local identifiers.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Object` | `clone()`
    `int` | `compareTo​(IgniteUuid o)`
    `boolean` | `equals​(Object obj)`
    `static IgniteUuid` | `fromString​(String s)` | Converts string into `IgniteUuid`.
    `static IgniteUuid` | `fromUuid​(UUID id)` | Constructs new `IgniteUuid` based on global and local ID portions.
    `UUID` | `globalId()` | Gets global ID portion of this `IgniteUuid`.
    `int` | `hashCode()`
    `org.apache.ignite.internal.util.lang.GridIterator<IgniteUuid>` | `iterator()`
    `static long` | `lastLocalId()` | Gets last generated local ID.
    `long` | `localId()` | Gets local ID portion of this `IgniteUuid`.
    `static IgniteUuid` | `randomUuid()` | Creates new pseudo-random ID.
    `void` | `readBinary​(BinaryReader reader)` | Reads fields from provided reader.
    `void` | `readExternal​(ObjectInput in)`
    `String` | `shortString()` | Gets a short string version of this ID.
    `String` | `toString()`
    `static UUID` | `vmId()` | Gets `UUID` associated with local VM.
    `void` | `writeBinary​(BinaryWriter writer)` | Writes fields to provided writer.
    `void` | `writeExternal​(ObjectOutput out)`

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

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

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Field Detail

    - #### VM_ID

          public static final UUID VM_ID

      VM ID.

  - ### Constructor Detail

    - #### IgniteUuid

          public IgniteUuid()

      Empty constructor required for `Externalizable`.

    - #### IgniteUuid

          public IgniteUuid​(UUID gid,
                            long locId)

      Constructs `IgniteUuid` from a global and local identifiers.
      Parameters:
        `gid` - UUID.
        `locId` - Counter.

  - ### Method Detail

    - #### vmId

          public static UUID vmId()

      Gets `UUID` associated with local VM.
      Returns:
        `UUID` associated with local VM.

    - #### lastLocalId

          public static long lastLocalId()

      Gets last generated local ID.
      Returns:
        Last generated local ID.

    - #### randomUuid

          public static IgniteUuid randomUuid()

      Creates new pseudo-random ID.
      Returns:
        Newly created pseudo-random ID.

    - #### fromUuid

          public static IgniteUuid fromUuid​(UUID id)

      Constructs new `IgniteUuid` based on global and local ID portions.
      Parameters:
        `id` - UUID instance.
      Returns:
        Newly created pseudo-random ID.

    - #### fromString

          public static IgniteUuid fromString​(String s)

      Converts string into `IgniteUuid`. The String must be in the format generated by `toString()` method.
      Parameters:
        `s` - String to convert to `IgniteUuid`.
      Returns:
        `IgniteUuid` instance representing given string.

    - #### shortString

          public String shortString()

      Gets a short string version of this ID. Use it only for UI where full version is available to the application.
      Returns:
        Short string version of this ID.

    - #### globalId

          public UUID globalId()

      Gets global ID portion of this `IgniteUuid`.
      Returns:
        Global ID portion of this `IgniteUuid`.

    - #### localId

          public long localId()

      Gets local ID portion of this `IgniteUuid`.
      Returns:
        Local ID portion of this `IgniteUuid`.

    - #### writeExternal

          public void writeExternal​(ObjectOutput out)
                             throws IOException

      Specified by:
        `writeExternal` in interface `Externalizable`
      Throws:
        `IOException`

    - #### readExternal

          public void readExternal​(ObjectInput in)
                            throws IOException

      Specified by:
        `readExternal` in interface `Externalizable`
      Throws:
        `IOException`

    - #### compareTo

          public int compareTo​(IgniteUuid o)

      Specified by:
        `compareTo` in interface `Comparable<IgniteUuid>`

    - #### iterator

          public org.apache.ignite.internal.util.lang.GridIterator<IgniteUuid> iterator()

      Specified by:
        `iterator` in interface `Iterable<IgniteUuid>`

    - #### equals

          public boolean equals​(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### writeBinary

          public void writeBinary​(BinaryWriter writer)
                           throws BinaryObjectException

      Writes fields to provided writer.
      Specified by:
        `writeBinary` in interface `Binarylizable`
      Parameters:
        `writer` - Binary object writer.
      Throws:
        `BinaryObjectException` - In case of error.

    - #### readBinary

          public void readBinary​(BinaryReader reader)
                          throws BinaryObjectException

      Reads fields from provided reader.
      Specified by:
        `readBinary` in interface `Binarylizable`
      Parameters:
        `reader` - Binary object reader.
      Throws:
        `BinaryObjectException` - In case of error.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### clone

          public Object clone()
                       throws CloneNotSupportedException

      Overrides:
        `clone` in class `Object`
      Throws:
        `CloneNotSupportedException`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`