in java/src/main/java/com/epam/deltix/containers/UUID.java [419:460]
public UUID assign(CharSequence string, int offset, UUIDParseFormat format) {
if (string == null)
throw new IllegalArgumentException("Argument 'string' cannot be null.");
if (string.length() < offset + 32)
throw new IllegalArgumentException("String 'string' is too short.");
if (format == UUIDParseFormat.ANY)
format = string.charAt(offset + 8) == '-' ? UUIDParseFormat.ANYCASE : UUIDParseFormat.ANYCASE_WITHOUT_DASHES;
switch (format) {
case LOWERCASE:
case UPPERCASE:
case ANYCASE: {
long m = extract(string, offset, 8, 0L, format);
if (string.charAt(offset + 8) != '-')
throw new IllegalArgumentException("UUID is improperly formatted.");
m = extract(string, offset + 9, 4, m, format);
if (string.charAt(offset + 13) != '-')
throw new IllegalArgumentException("UUID is improperly formatted.");
m = extract(string, offset + 14, 4, m, format);
if (string.charAt(offset + 18) != '-')
throw new IllegalArgumentException("UUID is improperly formatted.");
long l = extract(string, offset + 19, 4, 0L, format);
if (string.charAt(offset + 23) != '-')
throw new IllegalArgumentException("UUID is improperly formatted.");
l = extract(string, offset + 24, 12, l, format);
msb = m;
lsb = l;
break;
}
case LOWERCASE_WITHOUT_DASHES:
case UPPERCASE_WITHOUT_DASHES:
case ANYCASE_WITHOUT_DASHES:
msb = extract(string, offset, 16, 0L, format);
lsb = extract(string, offset + 16, 16, 0L, format);
break;
}
return this;
}