dojox/uuid/Uuid (version 1.10)

Summary

This is the constructor for the Uuid class. The Uuid class offers methods for inspecting existing UUIDs.

Usage

Uuid(input);
Parameter Type Description
input String
Optional

See the dojox/uuid/Uuid reference documentation for more information.

Examples

Example 1

var uuid; uuid = new dojox.uuid.Uuid("3b12f1df-5232-4804-897e-917bf397618a"); uuid = new dojox.uuid.Uuid(); // "00000000-0000-0000-0000-000000000000" uuid = new dojox.uuid.Uuid(dojox.uuid.generateRandomUuid()); uuid = new dojox.uuid.Uuid(dojox.uuid.generateTimeBasedUuid()); dojox.uuid.Uuid.setGenerator(dojox.uuid.generateRandomUuid); uuid = new dojox.uuid.Uuid(); dojox.uuid.assert(!uuid.isEqual(dojox.uuid.NIL_UUID));

Method Summary

  • compare(otherUuid) Compares this UUID to another UUID, and returns 0, 1, or -1.
  • compare(uuidOne,uuidTwo) Given two UUIDs to compare, this method returns 0, 1, or -1.
  • getGenerator() Returns the default generator.
  • getNode() If this is a version 1 UUID (a time-based UUID), getNode() returns a 12-character string with the "node" or "pseudonode" portion of the UUID, which is the rightmost 12 characters.
  • getTimestamp(returnType) If this is a version 1 UUID (a time-based UUID), this method returns the timestamp value encoded in the UUID.
  • getVariant() Returns a variant code that indicates what type of UUID this is.
  • getVersion() Returns a version number that indicates what type of UUID this is.
  • isEqual(otherUuid) Returns true if this UUID is equal to the otherUuid, or false otherwise.
  • isValid() Returns true if the UUID was initialized with a valid value.
  • setGenerator(generator) Sets the default generator, which will be used by the "new dojox.uuid.Uuid()" constructor if no parameters are passed in.
  • toString() This method returns a standard 36-character string representing the UUID, such as "3b12f1df-5232-4804-897e-917bf397618a".

Methods

compare(otherUuid)
Defined by dojox/uuid/Uuid

Compares this UUID to another UUID, and returns 0, 1, or -1.

This implementation is intended to match the sample implementation in IETF RFC 4122: http://www.ietf.org/rfc/rfc4122.txt

Parameter Type Description
otherUuid dojox/uuid/Uuid
compare(uuidOne,uuidTwo)
Defined by dojox/uuid/Uuid

Given two UUIDs to compare, this method returns 0, 1, or -1.

This method is designed to be used by sorting routines, like the JavaScript built-in Array sort() method. This implementation is intended to match the sample implementation in IETF RFC 4122: http://www.ietf.org/rfc/rfc4122.txt

Parameter Type Description
uuidOne dojox/uuid/Uuid
uuidTwo dojox/uuid/Uuid
getGenerator()
Defined by dojox/uuid/Uuid

Returns the default generator. See setGenerator().

getNode()
Defined by dojox/uuid/Uuid

If this is a version 1 UUID (a time-based UUID), getNode() returns a 12-character string with the "node" or "pseudonode" portion of the UUID, which is the rightmost 12 characters.

getTimestamp(returnType)
Defined by dojox/uuid/Uuid

If this is a version 1 UUID (a time-based UUID), this method returns the timestamp value encoded in the UUID. The caller can ask for the timestamp to be returned either as a JavaScript Date object or as a 15-character string of hex digits.

Parameter Type Description
returnType String
Optional
Returns:any

Returns the timestamp value as a JavaScript Date object or a 15-character string of hex digits.

Examples

Example 1

var uuid = new dojox.uuid.Uuid("b4308fb0-86cd-11da-a72b-0800200c9a66"); var date, string, hexString; date = uuid.getTimestamp(); // returns a JavaScript Date date = uuid.getTimestamp(Date); // string = uuid.getTimestamp(String); // "Mon, 16 Jan 2006 20:21:41 GMT" hexString = uuid.getTimestamp("hex"); // "1da86cdb4308fb0"

getVariant()
Defined by dojox/uuid/Uuid

Returns a variant code that indicates what type of UUID this is. Returns one of the enumerated dojox.uuid.variant values.

getVersion()
Defined by dojox/uuid/Uuid

Returns a version number that indicates what type of UUID this is. Returns one of the enumerated dojox.uuid.version values.

Examples

Example 1

var uuid = new dojox.uuid.Uuid("b4308fb0-86cd-11da-a72b-0800200c9a66"); var version = uuid.getVersion(); dojox.uuid.assert(version == dojox.uuid.version.TIME_BASED);

isEqual(otherUuid)
Defined by dojox/uuid/Uuid

Returns true if this UUID is equal to the otherUuid, or false otherwise.

Parameter Type Description
otherUuid dojox/uuid/Uuid
isValid()
Defined by dojox/uuid/Uuid

Returns true if the UUID was initialized with a valid value.

setGenerator(generator)
Defined by dojox/uuid/Uuid

Sets the default generator, which will be used by the "new dojox.uuid.Uuid()" constructor if no parameters are passed in.

Parameter Type Description
generator Function
Optional
toString()
Defined by dojox/uuid/Uuid

This method returns a standard 36-character string representing the UUID, such as "3b12f1df-5232-4804-897e-917bf397618a".

Error in the documentation? Can’t find what you are looking for? Let us know!