See the dojox/uuid/_base reference documentation for more information.
Throws an exception if the assertion fails.
If the asserted condition is true, this method does nothing. If the condition is false, we throw an error with a error message.
Parameter | Type | Description |
---|---|---|
booleanValue | Boolean | |
message | String |
Optional
|
This function returns the Nil UUID: "00000000-0000-0000-0000-000000000000".
The Nil UUID is described in section 4.1.7 of RFC 4122: http://tools.ietf.org/html/rfc4122#section-4.1.7
var string = dojox.uuid.generateNilUuid();
This function generates random UUIDs, meaning "version 4" UUIDs.
A typical generated value would be something like this: "3b12f1df-5232-4804-897e-917bf397618a"
For more information about random UUIDs, see sections 4.4 and 4.5 of RFC 4122: http://tools.ietf.org/html/rfc4122#section-4.4
This generator function is designed to be small and fast, but not necessarily good.
Small: This generator has a small footprint. Once comments are stripped, it's only about 25 lines of code, and it doesn't dojo.require() any other modules.
Fast: This generator can generate lots of new UUIDs fairly quickly (at least, more quickly than the other dojo UUID generators).
Not necessarily good: We use Math.random() as our source of randomness, which may or may not provide much randomness.
var string = dojox.uuid.generateRandomUuid();
This function generates time-based UUIDs, meaning "version 1" UUIDs.
For more info, see http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt http://www.infonuovo.com/dma/csdocs/sketch/instidid.htm http://kruithof.xs4all.nl/uuid/uuidgen http://www.opengroup.org/onlinepubs/009629399/apdxa.htm#tagcjh_20 http://jakarta.apache.org/commons/sandbox/id/apidocs/org/apache/commons/id/uuid/clock/Clock.html
Parameter | Type | Description |
---|---|---|
node | String |
Optional A 12-character hex string representing either a pseudo-node or hardware-node (an IEEE 802.3 network node). A hardware-node will be something like "017bf397618a", always with the first bit being 0. A pseudo-node will be something like "f17bf397618a", always with the first bit being 1. |
string = dojox.uuid.generateTimeBasedUuid(); string = dojox.uuid.generateTimeBasedUuid("017bf397618a"); dojox.uuid.generateTimeBasedUuid.setNode("017bf397618a"); string = dojox.uuid.generateTimeBasedUuid(); // the generated UUID has node == "017bf397618a"
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.
Parameter | Type | Description |
---|---|---|
uuidString | String |
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 |
---|---|---|
uuidString | String | |
returnType | String |
Optional Any of these five values: "string", String, "hex", "date", Date |
Returns the timestamp value as a JavaScript Date object or a 15-character string of hex digits.
var uuidString = "b4308fb0-86cd-11da-a72b-0800200c9a66"; var date, string, hexString; date = dojox.uuid.getTimestamp(uuidString); // returns a JavaScript Date date = dojox.uuid.getTimestamp(uuidString, Date); // string = dojox.uuid.getTimestamp(uuidString, String); // "Mon, 16 Jan 2006 20:21:41 GMT" hexString = dojox.uuid.getTimestamp(uuidString, "hex"); // "1da86cdb4308fb0"
Returns a variant code that indicates what type of UUID this is. Returns one of the enumerated dojox.uuid.variant values.
Parameter | Type | Description |
---|---|---|
uuidString | String |
var variant = dojox.uuid.getVariant("3b12f1df-5232-4804-897e-917bf397618a"); dojox.uuid.assert(variant == dojox.uuid.variant.DCE);
"3b12f1df-5232-4804-897e-917bf397618a" ^ | (variant "10__" == DCE)
Returns a version number that indicates what type of UUID this is. Returns one of the enumerated dojox.uuid.version values.
Parameter | Type | Description |
---|---|---|
uuidString | String |
var version = dojox.uuid.getVersion("b4308fb0-86cd-11da-a72b-0800200c9a66"); dojox.uuid.assert(version == dojox.uuid.version.TIME_BASED);
Returns true if the UUID was initialized with a valid value.
Parameter | Type | Description |
---|---|---|
uuidString | String |
This is the constructor for the Uuid class. The Uuid class offers methods for inspecting existing UUIDs.
Parameter | Type | Description |
---|---|---|
input | String |
Optional
|
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));