Uid implements Serializable { @Nonnull public static <T> Uid<T> fromHexString(@Nonnull final String id) { assert id != null; assert id.length() == 32; final long msb = (Long.parseLong(id.substring(0, 8), 16) << 32) | (Long.parseLong(id.substring(8, 16), 16)); final long lsb = (Long.parseLong(id.substring(16, 24), 16) << 32) | (Long.parseLong(id.substring(24, 32), 16)); return new Uid<>(new UUID(msb, lsb)); } Uid();  Uid(@Nonnull final String uuid); private  Uid(@Nonnull final UUID uuid); static boolean isValid(@Nullable final String id); @Nonnull static Uid<T> fromString(@Nonnull final String id); @Nonnull static Uid<T> fromHexString(@Nonnull final String id); @Nonnull String toHexString(); @SuppressWarnings({"unchecked", "UnusedParameters"}) @Nonnull Uid<T> as(@Nonnull final Class<T> ignored); boolean matchesFromString(@Nonnull final String uid); @Override boolean equals(@Nullable final Object obj); @Override int hashCode(); @Override @Nonnull String toString();  }
@Test public void testFromHexString() { LOG.info("testFromString"); final String s = "d32b6789-bfbb-4194-87f3-72ce34609902"; final Uid<Object> a = Uid.fromString(s); final Uid<Object> b = Uid.fromHexString(s.replaceAll("-", "")); Assert.assertEquals(a, b); }