/** * A mutable builder for a {@code PolicyIdInvalidException}. * * @param policyId the ID of the policy. * @return the builder. */ public static Builder newBuilder(@Nullable final CharSequence policyId) { return new Builder(policyId); }
/** * Constructs a new {@code PolicyIdInvalidException} object with the given exception message. * * @param message detail message. This message can be later retrieved by the {@link #getMessage()} method. * @param dittoHeaders the headers of the command which resulted in this exception. * @return the new PolicyIdInvalidException. * @throws NullPointerException if {@code dittoHeaders} is {@code null}. */ public static PolicyIdInvalidException fromMessage(@Nullable final String message, final DittoHeaders dittoHeaders) { return new Builder() .message(message) .dittoHeaders(dittoHeaders) .build(); }
/** * Constructs a new {@code PolicyIdInvalidException} object with the exception message extracted from the * given JSON object. * * @param jsonObject the JSON to read the {@link JsonFields#MESSAGE} field from. * @param dittoHeaders the headers of the command which resulted in this exception. * @return the new PolicyIdInvalidException. * @throws NullPointerException if any argument is {@code null}. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the {@code jsonObject} does not have the {@link JsonFields#MESSAGE} field. */ public static PolicyIdInvalidException fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new Builder() .dittoHeaders(dittoHeaders) .message(readMessage(jsonObject)) .description(readDescription(jsonObject).orElse(DEFAULT_DESCRIPTION)) .href(readHRef(jsonObject).orElse(null)) .build(); }