DATACMNS-1755 - Use method references in favor of lambdas.

Simplify several lambda expressions in the codebase by using
method references.

Original pull request: #448.
This commit is contained in:
Phillip Webb
2020-05-21 15:40:59 -07:00
committed by Mark Paluch
parent cb8443e299
commit b42cdb6568
10 changed files with 18 additions and 17 deletions

View File

@@ -195,8 +195,8 @@ public class AuditingHandler implements InitializingBean {
Assert.notNull(auditor,
() -> String.format("Auditor must not be null! Returned by: %s!", AopUtils.getTargetClass(it)));
auditor.filter(__ -> isNew).ifPresent(foo -> wrapper.setCreatedBy(foo));
auditor.filter(__ -> !isNew || modifyOnCreation).ifPresent(foo -> wrapper.setLastModifiedBy(foo));
auditor.filter(__ -> isNew).ifPresent(wrapper::setCreatedBy);
auditor.filter(__ -> !isNew || modifyOnCreation).ifPresent(wrapper::setLastModifiedBy);
return auditor;
});
@@ -216,8 +216,8 @@ public class AuditingHandler implements InitializingBean {
Assert.notNull(now, () -> String.format("Now must not be null! Returned by: %s!", dateTimeProvider.getClass()));
now.filter(__ -> isNew).ifPresent(it -> wrapper.setCreatedDate(it));
now.filter(__ -> !isNew || modifyOnCreation).ifPresent(it -> wrapper.setLastModifiedDate(it));
now.filter(__ -> isNew).ifPresent(wrapper::setCreatedDate);
now.filter(__ -> !isNew || modifyOnCreation).ifPresent(wrapper::setLastModifiedDate);
return now;
}