Package com.nomagic.magicreport.helper
Class UUIDGenerator
java.lang.Object
com.nomagic.magicreport.helper.UUIDGenerator
Create universal unique id.
Magic Draw element id consists of :
"_" + ApplicationConstants.VERSION + ApplicationConstants.PATCH_NUMBER + "_" + System.currentTimeMillis() + "_" +
Math.round(Math.random() * 1000000) + "_" + count++;
There is a very less change that element id is not unique.
Method getUUID() provides an always unique value for any purpose.
Method createId(String) provides an utility method to convert any string value e.g. Magic Draw element
id; into always unique 33 characters length value.
- Since:
- Jul 24, 2007
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringSometime element id in MagicDraw is not capable in other application e.g.static StringgetUUID()An immutable universally unique identifier (UUID).static StringtoHex(byte[] data) Convert array of bytes into string representation of the unsigned integer in base 16.
-
Method Details
-
createId
Sometime element id in MagicDraw is not capable in other application e.g. id length is too long. This method provides an utility to convert any string value into unique 33 characters length value.- Parameters:
id- original string value- Returns:
- an unique 33 characters long value.
-
getUUID
An immutable universally unique identifier (UUID). A UUID represents a 128-bit value.For more information including algorithms used to create UUIDs, see the Internet-Draft UUIDs and GUIDs or the standards body definition at ISO/IEC 11578:1996.
- Returns:
- 128-bit universally unique identifier (UUID)
-
toHex
Convert array of bytes into string representation of the unsigned integer in base 16.- Parameters:
data- array of bytes to be converted to a string.- Returns:
- the string in hexadecimal (base 16).
-