Java Utililty Methods UUID Create

List of utility methods to do UUID Create

Description

The list of methods to do UUID Create are organized into topic(s).

Method

StringgenMonUUID(String prefix)
gen Mon UUID
UUID uuid = UUID.randomUUID();
return prefix + uuid.toString();
StringgenMsgId()
gen Msg Id
return UUID.randomUUID().toString() + r.nextInt(10);
StringgenOntologyNS(String base)
gen Ontology NS
return base + UUID.randomUUID() + "#";
StringgenRandom(int length)
gen Random
StringBuffer sb = new StringBuffer();
while (sb.length() < length) {
    String random = UUID.randomUUID().toString().replace("-", "");
    sb.append(random);
return sb.toString().substring(0, length);
StringgenRandomString(int len)
gen Random String
return UUID.randomUUID().toString().replaceAll("-", "").toUpperCase().substring(0, len);
Stringget36UUID()
get UUID
return UUID.randomUUID().toString();
StringgetUUID()
get UUID
UUID uuid = UUID.randomUUID();
return (digits(uuid.getMostSignificantBits() >> 32, 8) + digits(uuid.getMostSignificantBits() >> 16, 4)
        + digits(uuid.getMostSignificantBits(), 4) + digits(uuid.getLeastSignificantBits() >> 48, 4)
        + digits(uuid.getLeastSignificantBits(), 12));
StringgetUUID()
Generate a random UUID string.
UUID id = UUID.randomUUID();
return id.toString();
UUIDgetUUID(String id)
get UUID
return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-"
        + id.substring(16, 20) + "-" + id.substring(20, 32));
ObjectgetUUIDForSql(UUID uuid)
get UUID For Sql
if (uuid != null)
    return uuid;
return null;