@Override public S putHeaders(final Map<String, String> headers) { checkNotNull(headers, "headers"); validateValueTypes(headers, definitions); this.headers.putAll(headers); return myself; }
@Override public S putHeaders(final Map<String, String> headers) { checkNotNull(headers, "headers"); validateValueTypes(headers, definitions); this.headers.putAll(headers); return myself; }
/** * Constructs a new {@code AbstractDittoHeadersBuilder} object. * * @param initialHeaders initial key-value-pairs or an empty map. * @param definitions a collection of all well known {@link HeaderDefinition}s of this builder. The definitions * are used for header value validation. * @param selfType this type is used to simulate the "self type" of the returned object for Method Chaining of * the builder methods. * @throws NullPointerException if any argument is {@code null}. */ @SuppressWarnings("unchecked") protected AbstractDittoHeadersBuilder(final Map<String, String> initialHeaders, final Collection<HeaderDefinition> definitions, final Class<?> selfType) { checkNotNull(initialHeaders, "initial headers"); checkNotNull(definitions, "header definitions"); validateValueTypes(initialHeaders, definitions); myself = (S) selfType.cast(this); headers = new HashMap<>(initialHeaders); this.definitions = new HashSet<>(definitions); Collections.addAll(this.definitions, DittoHeaderDefinition.values()); }
/** * Constructs a new {@code AbstractDittoHeadersBuilder} object. * * @param initialHeaders initial key-value-pairs or an empty map. * @param definitions a collection of all well known {@link HeaderDefinition}s of this builder. The definitions * are used for header value validation. * @param selfType this type is used to simulate the "self type" of the returned object for Method Chaining of * the builder methods. * @throws NullPointerException if any argument is {@code null}. */ @SuppressWarnings("unchecked") protected AbstractDittoHeadersBuilder(final Map<String, String> initialHeaders, final Collection<HeaderDefinition> definitions, final Class<?> selfType) { checkNotNull(initialHeaders, "initial headers"); checkNotNull(definitions, "header definitions"); validateValueTypes(initialHeaders, definitions); myself = (S) selfType.cast(this); headers = new HashMap<>(initialHeaders); this.definitions = new HashSet<>(definitions); Collections.addAll(this.definitions, DittoHeaderDefinition.values()); }