private Duration checkClaimTimeout(final long timeoutInSeconds) { // check if the timeout is smaller than the maximum possible claim-timeout and > 0: if ((timeoutInSeconds < 0) || (timeoutInSeconds > maxClaimTimeout.getSeconds())) { throw new TimeoutInvalidException(timeoutInSeconds, maxClaimTimeout.getSeconds()); } else { return Duration.ofSeconds(timeoutInSeconds); } }
/** * Deserialize from a JSON object. * * @param jsonObject the JSON object to deserialize. * @param dittoHeaders the headers. * @return an instance of this class. * @throws NullPointerException if any argument is {@code null}. */ public static TimeoutInvalidException fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new Builder() .loadJson(jsonObject) .dittoHeaders(dittoHeaders) .message(readMessage(jsonObject)) .description(readDescription(jsonObject).orElse(DEFAULT_DESCRIPTION)) .href(readHRef(jsonObject).orElse(null)) .build(); }
private Duration checkMessageTimeout(final long timeoutInSeconds) { // check if the timeout is smaller than the maximum possible message-timeout and > 0: if ((timeoutInSeconds < 0) || (timeoutInSeconds > maxMessageTimeout.getSeconds())) { throw new TimeoutInvalidException(timeoutInSeconds, maxMessageTimeout.getSeconds()); } else { return Duration.ofSeconds(timeoutInSeconds); } }
@Override protected TimeoutInvalidException doBuild(final DittoHeaders dittoHeaders, @Nullable final String message, @Nullable final String description, @Nullable final Throwable cause, @Nullable final URI href) { return new TimeoutInvalidException(dittoHeaders, message, description, cause, href); }