private SendMessageAcceptedResponse(final String thingId, final MessageHeaders messageHeaders, final HttpStatusCode statusCode, final DittoHeaders dittoHeaders) { super(TYPE, thingId, Message.<Void>newBuilder(messageHeaders).build(), statusCode, dittoHeaders); }
/** * Returns a mutable builder with a fluent API for building an immutable {@code Message}. * * @param messageHeaders the headers of the message to be built. * @param <T> the type of the Message's payload. * @return the new builder. * @throws NullPointerException if {@code messageHeaders} is {@code null}. */ static <T> MessageBuilder<T> newBuilder(final MessageHeaders messageHeaders) { return MessagesModelFactory.newMessageBuilder(messageHeaders); }
/** * Returns a new builder with a fluent API for an immutable MessageHeaders object for a Claim Message. * * @param thingId the thing ID of the message. * @return the builder. * @throws NullPointerException if {@code thingId} is {@code null}. * @throws IllegalArgumentException if {@code thingId} is empty. */ static MessageHeadersBuilder newBuilderForClaiming(final CharSequence thingId) { return newBuilder(MessageDirection.TO, thingId, KnownMessageSubjects.CLAIM_SUBJECT); }
private Builder(final JsonArray validationErrors) { message(MESSAGE); description(DEFAULT_DESCRIPTION); validationErrors(validationErrors); }
private Builder() { message(MESSAGE_TEMPLATE); description(DEFAULT_DESCRIPTION); }
private static String normalizeSubject(final String msgSubject) { if (msgSubject.isEmpty() || "/".equals(msgSubject)) { throw SubjectInvalidException.newBuilder(msgSubject).build(); } return msgSubject.charAt(0) == '/' ? msgSubject.substring(1) : msgSubject; }
@Override protected MessagePayloadSizeTooLargeException newInvalidSizeException(final long maxSize, final long actualSize, final DittoHeaders headers) { return MessagePayloadSizeTooLargeException.newBuilder(actualSize, maxSize).dittoHeaders(headers).build(); }
@Override public String getThingId() { return headers.getThingId(); }
@Override public Optional<String> getContentType() { return headers.getContentType(); }
/** * A mutable builder for a {@code MessageFormatInvalidException}. * * @param validationErrors errors to build the message from. * @return the builder. */ public static MessageFormatInvalidException.Builder newBuilder(final JsonArray validationErrors) { return new MessageFormatInvalidException.Builder(validationErrors); }
/** * A mutable builder for a {@code FeatureIdInvalidException}. * * @return the builder. */ public static Builder newBuilder() { return new Builder(); }
/** * Creates an {@code AuthorizationSubjectBlockedException} object. * * @return The new exception object. */ public static AuthorizationSubjectBlockedException newInstance() { return new AuthorizationSubjectBlockedException(); }
@Override public AuthorizationContext getAuthorizationContext() { return headers.getAuthorizationContext(); }
/** * A mutable builder for a {@code MessagePayloadSizeTooLargeException}. * * @param actualBytes the actual amount of bytes which were too much (gt {@code maxBytes}) * @param maxBytes the maximal allowed amount of bytes * @return the builder. */ public static Builder newBuilder(final long actualBytes, final long maxBytes) { return new Builder(actualBytes, maxBytes); }
/** * Returns a mutable builder with a fluent API for building an immutable {@link Message}. * * @param messageHeaders the headers of the message to be built. * @param <T> the type of the Message's payload. * @return the new builder. * @throws NullPointerException if {@code messageHeaders} is {@code null}. * @see #newHeadersBuilder(MessageDirection, CharSequence, CharSequence) */ public static <T> MessageBuilder<T> newMessageBuilder(final MessageHeaders messageHeaders) { return ImmutableMessageBuilder.newInstance(messageHeaders); }
/** * A mutable builder for a {@code SubjectInvalidException}. * * @param subject the subject. * @return the builder. */ public static Builder newBuilder(final String subject) { return new Builder(subject); }
@Override public Optional<Duration> getTimeout() { return headers.getTimeout(); }
@Override protected MessageHeaders doBuild(final DittoHeaders dittoHeaders) { return ImmutableMessageHeaders.of(dittoHeaders); }
private SendMessageAcceptedResponse(final String thingId, final MessageHeaders messageHeaders, final HttpStatusCode statusCode, final DittoHeaders dittoHeaders) { super(TYPE, thingId, Message.<Void>newBuilder(messageHeaders).build(), statusCode, dittoHeaders); }
@Override protected MessagePayloadSizeTooLargeException newInvalidSizeException(final long maxSize, final long actualSize, final DittoHeaders headers) { return MessagePayloadSizeTooLargeException.newBuilder(actualSize, maxSize).dittoHeaders(headers).build(); }