/** * Constructs a new {@link DittoHeaderInvalidException} 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 {@link DittoHeaderInvalidException}. * @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 DittoHeaderInvalidException 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(); }
/** * Constructs a new {@link DittoHeaderInvalidException} 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 {@link DittoHeaderInvalidException}. * @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 DittoHeaderInvalidException 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(); }
/** * A mutable builder for a {@link DittoHeaderInvalidException} with a custom message. * * @param customMessage the custom message * @return the builder. */ public static DittoHeaderInvalidException.Builder newCustomMessageBuilder(final String customMessage) { return new DittoHeaderInvalidException.Builder(customMessage); }
/** * A mutable builder for a {@link DittoHeaderInvalidException} with a custom message. * * @param customMessage the custom message * @return the builder. */ public static DittoHeaderInvalidException.Builder newCustomMessageBuilder(final String customMessage) { return new DittoHeaderInvalidException.Builder(customMessage); }
/** * A mutable builder for a {@link DittoHeaderInvalidException} in case of an invalid type. * * @param headerName the key of the header. * @param headerValue the value of the header. * @param headerType the type of the header. (int, String, entity-tag...) * @return the builder. */ public static DittoHeaderInvalidException.Builder newInvalidTypeBuilder(final String headerName, final String headerValue, final String headerType) { return new DittoHeaderInvalidException.Builder(headerName, headerValue, headerType); }
/** * A mutable builder for a {@link DittoHeaderInvalidException} in case of an invalid type. * * @param headerName the key of the header. * @param headerValue the value of the header. * @param headerType the type of the header. (int, String, entity-tag...) * @return the builder. */ public static DittoHeaderInvalidException.Builder newInvalidTypeBuilder(final String headerName, final String headerValue, final String headerType) { return new DittoHeaderInvalidException.Builder(headerName, headerValue, headerType); }