/** * Sets the timeout of the Message to build. * * @param timeout the duration of the Message to time out. * @return this builder to allow method chaining. */ public MessageHeadersBuilder timeout(@Nullable final Duration timeout) { final MessageHeaderDefinition definition = MessageHeaderDefinition.TIMEOUT; if (null != timeout) { putCharSequence(definition, String.valueOf(timeout.getSeconds())); } else { removeHeader(definition.getKey()); } return myself; }
/** * Sets the specified URL which is used for message validation. * * @param validationUrl the validation URL to be set. * @return this builder to allow method chaining. * @throws IllegalArgumentException if {@code validationUrl} is empty. */ public MessageHeadersBuilder validationUrl(@Nullable final CharSequence validationUrl) { final MessageHeaderDefinition definition = MessageHeaderDefinition.VALIDATION_URL; if (null != validationUrl) { putCharSequence(definition, validationUrl); } else { removeHeader(definition.getKey()); } return myself; }
/** * Sets the status code of the Message to build. * * @param statusCode the status code. * @return this builder to allow method chaining. */ public MessageHeadersBuilder statusCode(@Nullable final HttpStatusCode statusCode) { final MessageHeaderDefinition definition = MessageHeaderDefinition.STATUS_CODE; if (null != statusCode) { putCharSequence(definition, String.valueOf(statusCode.toInt())); } else { removeHeader(definition.getKey()); } return myself; }
/** * Sets the timestamp of the Message to build. * * @param timestamp the timestamp of the message. * @return this builder to allow method chaining. */ public MessageHeadersBuilder timestamp(@Nullable final OffsetDateTime timestamp) { final MessageHeaderDefinition definition = MessageHeaderDefinition.TIMESTAMP; if (null != timestamp) { putCharSequence(definition, timestamp.toString()); } else { removeHeader(definition.getKey()); } return myself; }