DATACMNS-867 - Additional Java 8 language feature cleanup.
Make use of lambdas and method references though out the codebase. Remove no longer required generic type parameters. Additionally remove unused imports and replace single element list initialization with dedicated singletonList. Use Assertion overloads taking Supplier for dynamic assertion error messages.
This commit is contained in:
committed by
Oliver Gierke
parent
aa4c51e1ea
commit
be347eaaab
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,7 @@ import org.springframework.util.Assert;
|
||||
* here, rather build your own base class and use the annotations directly.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @since 1.13
|
||||
*/
|
||||
public class AbstractAggregateRoot {
|
||||
@@ -37,7 +38,7 @@ public class AbstractAggregateRoot {
|
||||
* All domain events currently captured by the aggregate.
|
||||
*/
|
||||
@Getter(onMethod = @__(@DomainEvents)) //
|
||||
private transient final List<Object> domainEvents = new ArrayList<Object>();
|
||||
private transient final List<Object> domainEvents = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Registers the given event object for publication on a call to a Spring Data repository's save method.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,7 @@ import org.springframework.util.Assert;
|
||||
* A chunk of data restricted by the configured {@link Pageable}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @since 1.8
|
||||
*/
|
||||
abstract class Chunk<T> implements Slice<T>, Serializable {
|
||||
@@ -159,7 +160,7 @@ abstract class Chunk<T> implements Slice<T>, Serializable {
|
||||
|
||||
Assert.notNull(converter, "Converter must not be null!");
|
||||
|
||||
return this.stream().map(it -> converter.convert(it)).collect(Collectors.toList());
|
||||
return this.stream().map(converter::convert).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,7 +62,7 @@ public class ExampleMatcher {
|
||||
@Wither(AccessLevel.PRIVATE) MatchMode mode;
|
||||
|
||||
private ExampleMatcher() {
|
||||
this(NullHandler.IGNORE, StringMatcher.DEFAULT, new PropertySpecifiers(), Collections.<String>emptySet(), false,
|
||||
this(NullHandler.IGNORE, StringMatcher.DEFAULT, new PropertySpecifiers(), Collections.emptySet(), false,
|
||||
MatchMode.ALL);
|
||||
}
|
||||
|
||||
@@ -807,7 +807,7 @@ public class ExampleMatcher {
|
||||
@EqualsAndHashCode
|
||||
public static class PropertySpecifiers {
|
||||
|
||||
private final Map<String, PropertySpecifier> propertySpecifiers = new LinkedHashMap<String, PropertySpecifier>();
|
||||
private final Map<String, PropertySpecifier> propertySpecifiers = new LinkedHashMap<>();
|
||||
|
||||
PropertySpecifiers() {}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,7 @@ import org.springframework.data.domain.jaxb.SpringDataJaxb.SortDto;
|
||||
* {@link XmlAdapter} to convert {@link Pageable} instances int a {@link PageRequestDto} and vice versa.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
*/
|
||||
class PageableAdapter extends XmlAdapter<PageRequestDto, Pageable> {
|
||||
|
||||
@@ -42,7 +43,7 @@ class PageableAdapter extends XmlAdapter<PageRequestDto, Pageable> {
|
||||
SortDto sortDto = SortAdapter.INSTANCE.marshal(request.getSort());
|
||||
|
||||
PageRequestDto dto = new PageRequestDto();
|
||||
dto.orders = sortDto == null ? Collections.<OrderDto>emptyList() : sortDto.orders;
|
||||
dto.orders = sortDto == null ? Collections.emptyList() : sortDto.orders;
|
||||
dto.page = request.getPageNumber();
|
||||
dto.size = request.getPageSize();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user