diff --git a/symphony-bdk-legacy/symphony-api-client-java/src/main/java/model/OutboundMessage.java b/symphony-bdk-legacy/symphony-api-client-java/src/main/java/model/OutboundMessage.java index 92bef4564..c5549af97 100755 --- a/symphony-bdk-legacy/symphony-api-client-java/src/main/java/model/OutboundMessage.java +++ b/symphony-bdk-legacy/symphony-api-client-java/src/main/java/model/OutboundMessage.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; @JsonIgnoreProperties(ignoreUnknown = true) @@ -23,37 +24,25 @@ public OutboundMessage(String message, String data) { this.data = data; } - public OutboundMessage(String message, File[] attachment) { + public OutboundMessage(String message, File... attachment) { this.message = message; this.attachment = attachment; } - public OutboundMessage(String message, File attachment) { - this.message = message; - this.attachment = new File[] { attachment }; - } - - public OutboundMessage(String message, String data, File[] attachment) { + public OutboundMessage(String message, String data, File... attachment) { this.message = message; this.data = data; this.attachment = attachment; } - public OutboundMessage(String message, String data, File attachment) { - this.message = message; - this.data = data; - this.attachment = new File[] { attachment }; - } - public OutboundMessage(String message, List contentAttachment) { this.message = message; this.contentAttachment = contentAttachment; } - public OutboundMessage(String message, ContentAttachment contentAttachment) { + public OutboundMessage(String message, ContentAttachment... contentAttachment) { this.message = message; - this.contentAttachment = new ArrayList<>(); - this.contentAttachment.add(contentAttachment); + this.contentAttachment = Arrays.asList(contentAttachment); } public OutboundMessage(String message, String data, List contentAttachment) { @@ -62,11 +51,10 @@ public OutboundMessage(String message, String data, List cont this.contentAttachment = contentAttachment; } - public OutboundMessage(String message, String data, ContentAttachment contentAttachment) { + public OutboundMessage(String message, String data, ContentAttachment... contentAttachment) { this.message = message; this.data = data; - this.contentAttachment = new ArrayList<>(); - this.contentAttachment.add(contentAttachment); + this.contentAttachment = Arrays.asList(contentAttachment); } public String getMessage() { @@ -89,14 +77,10 @@ public File[] getAttachment() { return attachment; } - public void setAttachment(File[] attachment) { + public void setAttachment(File... attachment) { this.attachment = attachment; } - public void setAttachment(File attachment) { - this.attachment = new File[] { attachment }; - } - public void addAttachment(File attachment) { if (this.attachment == null) { this.attachment = new File[] { attachment }; @@ -116,9 +100,8 @@ public void setContentAttachment(List contentAttachment) { this.contentAttachment = contentAttachment; } - public void setContentAttachment(ContentAttachment contentAttachment) { - this.contentAttachment = new ArrayList<>(); - this.contentAttachment.add(contentAttachment); + public void setContentAttachment(ContentAttachment... contentAttachment) { + this.contentAttachment = Arrays.asList(contentAttachment); } public void addContentAttachment(ContentAttachment contentAttachment) {