/** * Returns new {@code Headers} for the specified {@code headersAsJson}. * * @param headersAsJson the headers as JSON. * @return the headers. */ public static DittoHeaders newHeaders(final JsonObject headersAsJson) { return DittoHeaders.newBuilder(headersAsJson).build(); }
private DittoHeaders buildDittoHeaders() { return DittoHeaders.newBuilder() .correlationId(batchId) .build(); }
private static DittoHeaders buildDevOpsDittoHeaders(final CharSequence correlationId) { return DittoHeaders.newBuilder() .schemaVersion(JsonSchemaVersion.V_2) .correlationId(correlationId) .build(); }
/** * Returns new {@code Headers} for the specified {@code headers} map. * * @param headers the headers map. * @return the headers. */ public static DittoHeaders newHeadersWithDittoContentType(final Map<String, String> headers) { return DittoHeaders.of(headers).toBuilder().contentType(DittoConstants.DITTO_PROTOCOL_CONTENT_TYPE).build(); }
/** * Returns new empty {@code Headers}. * * @return the headers. */ public static DittoHeaders emptyHeaders() { return DittoHeaders.empty(); }
/** * Returns a new instance of {@code DittoHeadersBuilder} initialized with the the properties of the given * {@code jsonObject}. * * @param jsonObject the JSON object which provides the initial properties of the builder. * @return a builder for creating {@code DittoHeaders} object. * @throws NullPointerException if {@code jsonObject} is {@code null}. */ static DefaultDittoHeadersBuilder of(final JsonObject jsonObject) { return of(toMap(jsonObject)); }
/** * Returns an empty {@code DittoHeaders} object. * * @return empty ditto headers. */ static DittoHeaders empty() { return DefaultDittoHeadersBuilder.newInstance().build(); }
/** * Returns a new builder for a {@code DittoHeaders} object which is initialised with the headers the specified * JSON object provides. * * @param jsonObject the JSON object which provides the initial headers. * @return the builder. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws IllegalArgumentException if {@code jsonObject} contains an invalid header. */ static DittoHeadersBuilder newBuilder(final JsonObject jsonObject) { return DefaultDittoHeadersBuilder.of(jsonObject); }
@Override public S authorizationSubjects(final Collection<String> authorizationSubjectIds) { putStringCollection(DittoHeaderDefinition.AUTHORIZATION_SUBJECTS, authorizationSubjectIds); return myself; }
@Override public S dryRun(final boolean dryRun) { putBoolean(DittoHeaderDefinition.DRY_RUN, dryRun); return myself; }
@Override public S origin(final CharSequence origin) { putCharSequence(DittoHeaderDefinition.ORIGIN, origin); return myself; }
/** * Returns a new instance of {@code DittoHeadersBuilder} initialized with the the properties of the given map. * * @param headers the header map which provides the initial properties of the builder. * @return a builder for creating {@code DittoHeaders} object. * @throws NullPointerException if {@code dittoHeaders} is {@code null}. * @throws org.eclipse.ditto.model.base.exceptions.DittoHeaderInvalidException if {@code headers} contains a value * that did not represent its appropriate Java type. */ static DefaultDittoHeadersBuilder of(final Map<String, String> headers) { return new DefaultDittoHeadersBuilder(headers); }
/** * Returns an instance of {@code ImmutableDittoHeaders} which is based on the specified map. * * @param headers the key-value-pairs of the result. * @return the instance. * @throws NullPointerException if {@code headers} is {@code null}. */ public static ImmutableDittoHeaders of(final Map<String, String> headers) { return new ImmutableDittoHeaders(headers); }
/** * Returns a new instance of {@code DittoHeaders} containing the specified key-value-pairs. * * @param headers the key-value-pairs of the result. * @return the DittoHeaders. * @throws NullPointerException if {@code headers} is {@code null}. * @throws IllegalArgumentException if {@code headers} contains an invalid key-value-pair. */ static DittoHeaders of(final Map<String, String> headers) { return newBuilder(headers).build(); }
/** * Returns new {@code Headers} for the specified {@code headers} map. * * @param headers the headers map. * @return the headers. */ public static DittoHeaders newHeadersWithDittoContentType(final Map<String, String> headers) { return DittoHeaders.of(headers).toBuilder().contentType(DittoConstants.DITTO_PROTOCOL_CONTENT_TYPE).build(); }
/** * Returns a mutable builder with a fluent API for immutable {@code DittoHeaders}. The builder is initialised with * the entries of this instance. * * @return the new builder. */ default DittoHeadersBuilder toBuilder() { return DefaultDittoHeadersBuilder.of(this); }
/** * Returns a new instance of {@code DittoHeaders} containing the specified key-value-pairs. * * @param headers the key-value-pairs of the result. * @return the DittoHeaders. * @throws NullPointerException if {@code headers} is {@code null}. * @throws IllegalArgumentException if {@code headers} contains an invalid key-value-pair. */ static DittoHeaders of(final Map<String, String> headers) { return newBuilder(headers).build(); }
/** * Returns new {@code Headers} for the specified {@code headersAsJson}. * * @param headersAsJson the headers as JSON. * @return the headers. */ public static DittoHeaders newHeaders(final JsonObject headersAsJson) { return DittoHeaders.newBuilder(headersAsJson).build(); }