Skip to content

Commit 0e7d54f

Browse files
committed
Implemented Builder Pattern
Signed-off-by: Nico Piel <[email protected]>
1 parent f75dce1 commit 0e7d54f

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

server/src/com/mirth/connect/plugins/serverlog/ServerLogItem.java

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,93 @@ public ServerLogItem(String serverId, Long id, String channelId, String channelN
5555
this.throwableInformation = throwableInformation;
5656
}
5757

58+
private ServerLogItem(Builder builder) {
59+
this.serverId = builder.serverId;
60+
this.id = builder.id;
61+
this.channelId = builder.channelId;
62+
this.channelName = builder.channelName;
63+
this.level = builder.level;
64+
this.date = builder.date;
65+
this.threadName = builder.threadName;
66+
this.category = builder.category;
67+
this.lineNumber = builder.lineNumber;
68+
this.message = builder.message;
69+
this.throwableInformation = builder.throwableInformation;
70+
}
71+
72+
public static class Builder {
73+
private String serverId;
74+
private Long id;
75+
private String channelId;
76+
private String channelName;
77+
private String level;
78+
private Date date;
79+
private String threadName;
80+
private String category;
81+
private String lineNumber;
82+
private String message;
83+
private String throwableInformation;
84+
85+
public Builder serverId(String serverId) {
86+
this.serverId = serverId;
87+
return this;
88+
}
89+
90+
public Builder id(Long id) {
91+
this.id = id;
92+
return this;
93+
}
94+
95+
public Builder channelId(String channelId) {
96+
this.channelId = channelId;
97+
return this;
98+
}
99+
100+
public Builder channelName(String channelName) {
101+
this.channelName = channelName;
102+
return this;
103+
}
104+
105+
public Builder level(String level) {
106+
this.level = level;
107+
return this;
108+
}
109+
110+
public Builder date(Date date) {
111+
this.date = date;
112+
return this;
113+
}
114+
115+
public Builder threadName(String threadName) {
116+
this.threadName = threadName;
117+
return this;
118+
}
119+
120+
public Builder category(String category) {
121+
this.category = category;
122+
return this;
123+
}
124+
125+
public Builder lineNumber(String lineNumber) {
126+
this.lineNumber = lineNumber;
127+
return this;
128+
}
129+
130+
public Builder message(String message) {
131+
this.message = message;
132+
return this;
133+
}
134+
135+
public Builder throwableInformation(String throwableInformation) {
136+
this.throwableInformation = throwableInformation;
137+
return this;
138+
}
139+
140+
public ServerLogItem build() {
141+
return new ServerLogItem(this);
142+
}
143+
}
144+
58145
public String getServerId() {
59146
return serverId;
60147
}

0 commit comments

Comments
 (0)