#1059 - Cleanup the core codebase.
Clean up code containing various patterns: * Remove redundant `final`, `public`, and `static` declarations in interfaces and enums. * Replace redundant `? extends Object` generic parameters with `?`. * Convert collections to arrays using empty array instead of pre-sized one (modern JVM recommendation). * Initialize collections using constructor call over `addAll`. * Favor `addAll` over iterating and adding one-by-one. * Take advantage of `Map.forEach` that was introduced with Java 8.
This commit is contained in:
@@ -127,7 +127,7 @@ public interface EntityLinks extends Plugin<Class<?>> {
|
||||
* @param extractor the extractor to use to derive an identifier from the given entity.
|
||||
* @return
|
||||
*/
|
||||
default <T> TypedEntityLinks<T> forType(Function<T, ? extends Object> extractor) {
|
||||
default <T> TypedEntityLinks<T> forType(Function<T, ?> extractor) {
|
||||
return new TypedEntityLinks<>(extractor, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ public interface LinkRelationProvider extends Plugin<LookupContext> {
|
||||
*/
|
||||
@RequiredArgsConstructor(staticName = "of", access = AccessLevel.PRIVATE)
|
||||
@EqualsAndHashCode
|
||||
static class LookupContext {
|
||||
class LookupContext {
|
||||
|
||||
private enum ResourceType {
|
||||
ITEM, COLLECTION;
|
||||
ITEM, COLLECTION
|
||||
}
|
||||
|
||||
private final @NonNull @Getter Class<?> type;
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
|
||||
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
|
||||
public class TypedEntityLinks<T> {
|
||||
|
||||
private final @NonNull Function<T, ? extends Object> identifierExtractor;
|
||||
private final @NonNull Function<T, ?> identifierExtractor;
|
||||
private final @NonNull EntityLinks entityLinks;
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ public class TypedEntityLinks<T> {
|
||||
private final Class<T> type;
|
||||
private final EntityLinks delegate;
|
||||
|
||||
ExtendedTypedEntityLinks(Function<T, ? extends Object> identifierExtractor, EntityLinks delegate, Class<T> type) {
|
||||
ExtendedTypedEntityLinks(Function<T, ?> identifierExtractor, EntityLinks delegate, Class<T> type) {
|
||||
|
||||
super(identifierExtractor, delegate);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.web.util.UriTemplate;
|
||||
*/
|
||||
public class UriTemplateFactory {
|
||||
|
||||
private static final Map<String, UriTemplate> CACHE = new ConcurrentReferenceHashMap<String, UriTemplate>();
|
||||
private static final Map<String, UriTemplate> CACHE = new ConcurrentReferenceHashMap<>();
|
||||
|
||||
/**
|
||||
* Returns the the {@link UriTemplate} for the given mapping.
|
||||
|
||||
@@ -142,7 +142,7 @@ public class RepresentationModelProcessorHandlerMethodReturnValueHandler impleme
|
||||
return rootLinksAsHeaders ? HeaderLinksResponseEntity.wrap(newBody) : newBody;
|
||||
}
|
||||
|
||||
HttpEntity<RepresentationModel<?>> entity = null;
|
||||
HttpEntity<RepresentationModel<?>> entity;
|
||||
|
||||
if (originalValue instanceof ResponseEntity) {
|
||||
ResponseEntity<?> source = (ResponseEntity<?>) originalValue;
|
||||
|
||||
Reference in New Issue
Block a user