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

@@ -94,7 +94,7 @@ public class PagedResourcesAssembler<T> implements RepresentationModelAssembler<
@Override
@SuppressWarnings("null")
public PagedModel<EntityModel<T>> toModel(Page<T> entity) {
return toModel(entity, it -> EntityModel.of(it));
return toModel(entity, EntityModel::of);
}
/**
@@ -107,7 +107,7 @@ public class PagedResourcesAssembler<T> implements RepresentationModelAssembler<
* @return
*/
public PagedModel<EntityModel<T>> toModel(Page<T> page, Link selfLink) {
return toModel(page, it -> EntityModel.of(it), selfLink);
return toModel(page, EntityModel::of, selfLink);
}
/**
@@ -230,7 +230,7 @@ public class PagedResourcesAssembler<T> implements RepresentationModelAssembler<
resources.add(createLink(base, page.previousPageable(), IanaLinkRelations.PREV));
}
Link selfLink = link.map(it -> it.withSelfRel())//
Link selfLink = link.map(Link::withSelfRel)//
.orElseGet(() -> createLink(base, page.getPageable(), IanaLinkRelations.SELF));
resources.add(selfLink);

View File

@@ -169,7 +169,7 @@ public class SpringDataWebConfiguration implements WebMvcConfigurer, BeanClassLo
if (ClassUtils.isPresent("org.xmlbeam.XBProjector", context.getClassLoader())) {
converters.add(0, context.getBeanProvider(XmlBeamHttpMessageConverter.class) //
.getIfAvailable(() -> new XmlBeamHttpMessageConverter()));
.getIfAvailable(XmlBeamHttpMessageConverter::new));
}
}