/** * Set the value for the given header name only if the header name is not already associated with a value. * * @param headerName The header name. * @param headerValue The header value. * @return this MessageBuilder. */ @Override public MessageBuilder<T> setHeaderIfAbsent(String headerName, Object headerValue) { this.headerAccessor.setHeaderIfAbsent(headerName, headerValue); return this; }
/** * Copy the name-value pairs from the provided Map. This operation will <em>not</em> overwrite any existing values. * * @param headersToCopy The headers to copy. * @return this MessageBuilder. */ @Override public MessageBuilder<T> copyHeadersIfAbsent(@Nullable Map<String, ?> headersToCopy) { if (headersToCopy != null) { for (Map.Entry<String, ?> entry : headersToCopy.entrySet()) { String headerName = entry.getKey(); if (!this.headerAccessor.isReadOnly(headerName)) { this.headerAccessor.setHeaderIfAbsent(headerName, entry.getValue()); } } } return this; }
/** * Set the value for the given header name only if the header name is not already associated with a value. * * @param headerName The header name. * @param headerValue The header value. * @return this MessageBuilder. */ @Override public MessageBuilder<T> setHeaderIfAbsent(String headerName, Object headerValue) { this.headerAccessor.setHeaderIfAbsent(headerName, headerValue); return this; }
/** * Copy the name-value pairs from the provided Map. This operation will <em>not</em> overwrite any existing values. * * @param headersToCopy The headers to copy. * @return this MessageBuilder. */ @Override public MessageBuilder<T> copyHeadersIfAbsent(@Nullable Map<String, ?> headersToCopy) { if (headersToCopy != null) { for (Map.Entry<String, ?> entry : headersToCopy.entrySet()) { String headerName = entry.getKey(); if (!this.headerAccessor.isReadOnly(headerName)) { this.headerAccessor.setHeaderIfAbsent(headerName, entry.getValue()); } } } return this; }