Skip to content

Commit

Permalink
APP-3018: Using varargs in constructor and setAttachment methods (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
symphony-hong authored Sep 3, 2020
1 parent e5c8a04 commit 24771c4
Showing 1 changed file with 10 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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> 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> contentAttachment) {
Expand All @@ -62,11 +51,10 @@ public OutboundMessage(String message, String data, List<ContentAttachment> 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() {
Expand All @@ -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 };
Expand All @@ -116,9 +100,8 @@ public void setContentAttachment(List<ContentAttachment> 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) {
Expand Down

0 comments on commit 24771c4

Please sign in to comment.