org.apache.ignite.lang

## Class IgniteUuid

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

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

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

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
`static UUID` `VM_ID` VM ID.

### Constructor Summary

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

### Method Summary

Methods
`Object` `clone()`
`int` `compareTo(IgniteUuid o)`
`boolean` `equals(Object obj)`
`static IgniteUuid` `fromString(String s)` Converts string into `GridUuid`.
`static IgniteUuid` `fromUuid(UUID id)` Constructs new `GridUuid` based on global and local ID portions.
`UUID` `globalId()` Gets global ID portion of this `GridUuid`.
`int` `hashCode()`
`GridIterator<IgniteUuid>` `iterator()`
`static long` `lastLocalId()` Gets last generated local ID.
`long` `localId()` Gets local ID portion of this `GridUuid`.
`static IgniteUuid` `randomUuid()` Creates new pseudo-random ID.
`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` `writeExternal(ObjectOutput out)`

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

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

### 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 `GridUuid` 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 `GridUuid` 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 `GridUuid`. The String must be in the format generated by `GridUuid.toString()` method.

Parameters:
  `s` - String to convert to `GridUuid`.
Returns:
  `GridUuid` 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 `GridUuid`.

Returns:
  Global ID portion of this `GridUuid`.

#### localId

    public long localId()

Gets local ID portion of this `GridUuid`.

Returns:
  Local ID portion of this `GridUuid`.

#### 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 GridIterator<IgniteUuid> iterator()

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

#### equals

    public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

#### 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`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.3.0-incubating
Release Date | : July 10 2015