class UniqueId implements Comparable<UniqueId>, UniqueIdentifiable, ObjectIdentifiable, Serializable {

  @FromString
  public static UniqueId parse(String str) {
    ArgumentChecker.notEmpty(str, "str");
    if (str.contains("~") == false) {
      str = StringUtils.replace(str, "::", "~");  // leniently parse old data
    }
    String[] split = StringUtils.splitByWholeSeparatorPreserveAllTokens(str, "~");
    switch (split.length) {
      case 2:
        return UniqueId.of(split[0], split[1], null);
      case 3:
        return UniqueId.of(split[0], split[1], split[2]);
    }
    throw new IllegalArgumentException("Invalid identifier format: " + str);
  }

  private  UniqueId(String scheme, String value, String version);

}