This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch sa in repository https://gitbox.apache.org/repos/asf/camel.git
commit 53a1e4e4d71d1a560b922122929cc98fff658fbf Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Feb 4 07:54:07 2025 +0100 Polished --- .../org/apache/camel/attachment/Attachment.java | 28 +++++++++++----------- .../apache/camel/attachment/DefaultAttachment.java | 15 ++++++------ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/components/camel-attachments/src/main/java/org/apache/camel/attachment/Attachment.java b/components/camel-attachments/src/main/java/org/apache/camel/attachment/Attachment.java index 740e3b4996a..01c8a517fc3 100644 --- a/components/camel-attachments/src/main/java/org/apache/camel/attachment/Attachment.java +++ b/components/camel-attachments/src/main/java/org/apache/camel/attachment/Attachment.java @@ -38,15 +38,15 @@ public interface Attachment { /** * Get all the headers for this header name. Returns null if no headers for this header name are available. * - * @param headerName he name of this header - * @return a comma separated list of all header values + * @param name the name of this header + * @return a comma separated list of all header values */ - String getHeader(String headerName); + String getHeader(String name); /** * Get all the headers for this header name. Returns null if no headers for this header name are available. * - * @param name The name of this header + * @param name the name of this header * @return a list of all header values */ List<String> getHeaderAsList(String name); @@ -59,25 +59,25 @@ public interface Attachment { Collection<String> getHeaderNames(); /** - * Set the value for this headerName. Replaces all existing header values with this new value. + * Set the value for this header. Replaces any existing header with the same name. * - * @param headerName the name of this header - * @param headerValue the value for this header + * @param name the name of this header + * @param value the value for this header */ - void setHeader(String headerName, String headerValue); + void setHeader(String name, String value); /** - * Add this value to the existing values for this headerName. + * Add this value to the existing values for this header. * - * @param headerName the name of this header - * @param headerValue the value for this header + * @param name the name of this header + * @param value the value for this header */ - void addHeader(String headerName, String headerValue); + void addHeader(String name, String value); /** * Remove all headers with this name. * - * @param headerName the name of this header + * @param name the name of this header */ - void removeHeader(String headerName); + void removeHeader(String name); } diff --git a/components/camel-attachments/src/main/java/org/apache/camel/attachment/DefaultAttachment.java b/components/camel-attachments/src/main/java/org/apache/camel/attachment/DefaultAttachment.java index b1490975e38..b95d694e6af 100644 --- a/components/camel-attachments/src/main/java/org/apache/camel/attachment/DefaultAttachment.java +++ b/components/camel-attachments/src/main/java/org/apache/camel/attachment/DefaultAttachment.java @@ -28,8 +28,9 @@ import jakarta.activation.DataSource; import org.apache.camel.util.CollectionHelper; public class DefaultAttachment implements Attachment { + + private final DataHandler dataHandler; private Map<String, Object> headers; - private DataHandler dataHandler; public DefaultAttachment(DataHandler dh) { dataHandler = dh; @@ -72,25 +73,25 @@ public class DefaultAttachment implements Attachment { } @Override - public void addHeader(String headerName, String headerValue) { + public void addHeader(String name, String value) { if (headers == null) { headers = createHeaders(); } - CollectionHelper.appendValue(headers, headerName, headerValue); + CollectionHelper.appendValue(headers, name, value); } @Override - public void setHeader(String headerName, String headerValue) { + public void setHeader(String headerName, String value) { if (headers == null) { headers = createHeaders(); } - headers.put(headerName, headerValue); + headers.put(headerName, value); } @Override - public void removeHeader(String headerName) { + public void removeHeader(String name) { if (headers != null) { - headers.remove(headerName); + headers.remove(name); } }