@Override public StandardId build() { return new StandardId( scheme, value); }
private Object readResolve() { return new StandardId(scheme, value); }
/** * Obtains an instance from a scheme and value. * <p> * The scheme must be non-empty and match the regular expression '{@code [A-Za-z0-9:/+.=_-]*}'. * This permits letters, numbers, colon, forward-slash, plus, dot, equals, underscore and dash. * If necessary, the scheme can be encoded using {@link StandardId#encodeScheme(String)}. * <p> * The value must be non-empty and match the regular expression '{@code [!-z][ -z]*}'. * This includes all standard printable ASCII characters excluding curly brackets, pipe and tilde. * * @param scheme the scheme of the identifier, not empty * @param value the value of the identifier, not empty * @return the identifier */ public static StandardId of(String scheme, String value) { return new StandardId(scheme, value); }
/** * Parses an {@code StandardId} from a formatted scheme and value. * <p> * This parses the identifier from the form produced by {@code toString()} * which is '{@code $scheme~$value}'. * * @param str the identifier to parse * @return the identifier * @throws IllegalArgumentException if the identifier cannot be parsed */ @FromString public static StandardId parse(String str) { int pos = ArgChecker.notNull(str, "str").indexOf("~"); if (pos < 0) { throw new IllegalArgumentException("Invalid identifier format: " + str); } return new StandardId(str.substring(0, pos), str.substring(pos + 1)); }