@Test public void testParseEmpty() { assertNull(IdUtils.tryParse("")); }
public static UUID tryParse(final String str) { if (str == null) { return null; } if (!PATTERN.matcher(str).matches()) { return null; } final String clean = str.replace("-", ""); if (clean.length() != 32) { return null; } final long msb = Long.parseUnsignedLong(clean.substring(0, 16), 16); final long lsb = Long.parseUnsignedLong(clean.substring(16), 16); return new UUID(msb, lsb); }
IdUtils { public static UUID tryParse(final String str) { if (str == null) { return null; } if (!PATTERN.matcher(str).matches()) { return null; } final String clean = str.replace("-", ""); if (clean.length() != 32) { return null; } final long msb = Long.parseUnsignedLong(clean.substring(0, 16), 16); final long lsb = Long.parseUnsignedLong(clean.substring(16), 16); return new UUID(msb, lsb); } }
IdUtils { public static UUID tryParse(final String str) { if (str == null) { return null; } if (!PATTERN.matcher(str).matches()) { return null; } final String clean = str.replace("-", ""); if (clean.length() != 32) { return null; } final long msb = Long.parseUnsignedLong(clean.substring(0, 16), 16); final long lsb = Long.parseUnsignedLong(clean.substring(16), 16); return new UUID(msb, lsb); } IdUtils(); }
IdUtils { public static UUID tryParse(final String str) { if (str == null) { return null; } if (!PATTERN.matcher(str).matches()) { return null; } final String clean = str.replace("-", ""); if (clean.length() != 32) { return null; } final long msb = Long.parseUnsignedLong(clean.substring(0, 16), 16); final long lsb = Long.parseUnsignedLong(clean.substring(16), 16); return new UUID(msb, lsb); } IdUtils(); static UUID create(); static UUID tryParse(final String str); static byte[] toBytes(final UUID id); static UUID fromBytes(final byte[] b); }
IdUtils { public static UUID tryParse(final String str) { if (str == null) { return null; } if (!PATTERN.matcher(str).matches()) { return null; } final String clean = str.replace("-", ""); if (clean.length() != 32) { return null; } final long msb = Long.parseUnsignedLong(clean.substring(0, 16), 16); final long lsb = Long.parseUnsignedLong(clean.substring(16), 16); return new UUID(msb, lsb); } IdUtils(); static UUID create(); static UUID tryParse(final String str); static byte[] toBytes(final UUID id); static UUID fromBytes(final byte[] b);  }