Skip to content

Commit 0ea6144

Browse files
committed
Replace deprecated ObjectUtils.defaultIfNull
1 parent b01a70f commit 0ea6144

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/main/java/no/digipost/api/client/representations/Message.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import static no.digipost.api.client.representations.Channel.PRINT;
4343
import static org.apache.commons.lang3.ArrayUtils.INDEX_NOT_FOUND;
4444
import static org.apache.commons.lang3.ArrayUtils.indexOf;
45-
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
45+
import static org.apache.commons.lang3.ObjectUtils.getIfNull;
4646
import static org.apache.commons.lang3.StringUtils.join;
4747

4848
@XmlAccessorType(XmlAccessType.FIELD)
@@ -55,7 +55,7 @@
5555
"invoiceReference",
5656
"primaryDocument",
5757
"attachments",
58-
"printIfUnread",
58+
"printIfUnread",
5959
"requestForRegistration",
6060
"batch"})
6161
@XmlRootElement(name = "message")
@@ -195,15 +195,15 @@ public MessageBuilder attachments(Document ... attachments) {
195195
}
196196

197197
public MessageBuilder attachments(Iterable<? extends Document> attachments) {
198-
defaultIfNull(attachments, Collections.<Document>emptyList()).forEach(this.attachments::add);
198+
getIfNull(attachments, Collections.<Document>emptyList()).forEach(this.attachments::add);
199199
return this;
200200
}
201201

202202
public MessageBuilder batch(UUID batchUUID) {
203203
this.batch = new Batch(batchUUID.toString());
204204
return this;
205205
}
206-
206+
207207
public Message build() {
208208
if (recipient == null) {
209209
throw new IllegalStateException("You must specify a recipient.");
@@ -227,7 +227,7 @@ private Message(String messageId, Long senderId, SenderOrganization senderOrgani
227227
this.invoiceReference = invoiceReference;
228228
this.deliveryTime = deliveryTime;
229229
this.attachments = new ArrayList<>();
230-
for (Document attachment : defaultIfNull(attachments, Collections.<Document>emptyList())) {
230+
for (Document attachment : getIfNull(attachments, Collections.<Document>emptyList())) {
231231
this.attachments.add(attachment);
232232
}
233233
this.printIfUnread = printIfUnread;

src/main/java/no/digipost/api/client/representations/archive/Archive.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
import static java.util.Arrays.asList;
4343
import static no.digipost.api.client.representations.Relation.NEXT_DOCUMENTS;
44-
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
44+
import static org.apache.commons.lang3.ObjectUtils.getIfNull;
4545

4646
@XmlAccessorType(XmlAccessType.FIELD)
4747
@XmlType(name = "archive", propOrder = {
@@ -134,7 +134,7 @@ public Optional<URI> getNextDocumentsWithAttributes(Map<String, String> attribut
134134

135135
public Optional<URI> getNextDocumentsWithAttributesByDate(Map<String, String> attributes, OffsetDateTime from, OffsetDateTime to) {
136136
final String attributesCommaSeparated = attributes.entrySet().stream().flatMap(en -> Stream.of(en.getKey(), en.getValue())).collect(Collectors.joining(","));
137-
137+
138138
return Optional.ofNullable(getLinkByRelationName(NEXT_DOCUMENTS)).map(Link::getUri)
139139
.map(uri -> {
140140
try {
@@ -150,7 +150,7 @@ public Optional<URI> getNextDocumentsWithAttributesByDate(Map<String, String> at
150150
}
151151

152152
public Optional<URI> getNextDocumentsByDate(OffsetDateTime from, OffsetDateTime to) {
153-
153+
154154
return Optional.ofNullable(getLinkByRelationName(NEXT_DOCUMENTS)).map(Link::getUri)
155155
.map(uri -> {
156156
try {
@@ -202,7 +202,7 @@ public ArchiveBuilder documents(ArchiveDocument... documents) {
202202
}
203203

204204
public ArchiveBuilder documents(Iterable<ArchiveDocument> documents) {
205-
defaultIfNull(documents, Collections.<ArchiveDocument>emptyList()).forEach(this.documents::add);
205+
getIfNull(documents, Collections.<ArchiveDocument>emptyList()).forEach(this.documents::add);
206206
return this;
207207
}
208208

@@ -218,5 +218,5 @@ public Archive build() {
218218
private static String base64(String param){
219219
return Base64.getEncoder().encodeToString(param.getBytes(StandardCharsets.UTF_8));
220220
}
221-
221+
222222
}

0 commit comments

Comments
 (0)