#788 - Fixed obvious warning in all touched files.
* Fixed assertions. * Removed superfluous code. * Simplified generics. * Formatting.
This commit is contained in:
committed by
Greg Turnquist
parent
4081e58a1f
commit
9f4f1ad79b
@@ -58,7 +58,7 @@ public class Link implements Serializable {
|
||||
|
||||
private static final Pattern URI_AND_ATTRIBUTES_PATTERN = Pattern.compile("<(.*)>;(.*)");
|
||||
private static final Pattern KEY_AND_VALUE_PATTERN = Pattern
|
||||
.compile("(\\w+)=\"(\\p{Lower}[\\p{Lower}\\p{Digit}\\.\\-\\s]*|" + URI_PATTERN + ")\"");
|
||||
.compile("(\\w+)=\"(\\p{Lower}[\\p{Lower}\\p{Digit}.\\-\\s]*|" + URI_PATTERN + ")\"");
|
||||
|
||||
public static final String ATOM_NAMESPACE = "http://www.w3.org/2005/Atom";
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ public class VndErrors implements Iterable<VndErrors.VndError> {
|
||||
* Creates a new {@link VndErrors} wrapper for at least one {@link VndError}.
|
||||
*
|
||||
* @param errors must not be {@literal null}.
|
||||
* @param errors
|
||||
*/
|
||||
public VndErrors(VndError error, VndError... errors) {
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
@@ -145,7 +146,7 @@ public class ConverterRegisteringWebMvcConfigurer implements WebMvcConfigurer, B
|
||||
mapper.setHandlerInstantiator(new UberHandlerInstantiator());
|
||||
|
||||
return new TypeConstrainedMappingJackson2HttpMessageConverter(
|
||||
ResourceSupport.class, Arrays.asList(UBER_JSON), mapper);
|
||||
ResourceSupport.class, Collections.singletonList(UBER_JSON), mapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +165,7 @@ public class ConverterRegisteringWebMvcConfigurer implements WebMvcConfigurer, B
|
||||
mapper.setHandlerInstantiator(new CollectionJsonHandlerInstantiator(linkRelationMessageSource));
|
||||
|
||||
return new TypeConstrainedMappingJackson2HttpMessageConverter(
|
||||
ResourceSupport.class, Arrays.asList(COLLECTION_JSON), mapper);
|
||||
ResourceSupport.class, Collections.singletonList(COLLECTION_JSON), mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +187,7 @@ public class ConverterRegisteringWebMvcConfigurer implements WebMvcConfigurer, B
|
||||
this.halFormsConfiguration.getIfAvailable(HalFormsConfiguration::new)));
|
||||
|
||||
return new TypeConstrainedMappingJackson2HttpMessageConverter(
|
||||
ResourceSupport.class, Arrays.asList(HAL_FORMS_JSON), mapper);
|
||||
ResourceSupport.class, Collections.singletonList(HAL_FORMS_JSON), mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
*/
|
||||
public class AnnotationMappingDiscoverer implements MappingDiscoverer {
|
||||
|
||||
private static final Pattern MULTIPLE_SLASHES = Pattern.compile("\\/{2,}");
|
||||
private static final Pattern MULTIPLE_SLASHES = Pattern.compile("/{2,}");
|
||||
|
||||
private final Class<? extends Annotation> annotationType;
|
||||
private final String mappingAttributeName;
|
||||
|
||||
@@ -145,7 +145,7 @@ public class DummyInvocationUtils {
|
||||
* equips it with an {@link InvocationRecordingMethodInterceptor}. The interceptor records the last invocation and
|
||||
* returns a proxy of the return type that also implements {@link LastInvocationAware} so that the last method
|
||||
* invocation can be inspected. Parameters passed to the subsequent method invocation are generally neglected except
|
||||
* the ones that might be mapped into the URI translation eventually, e.g. {@linke PathVariable} in the case of Spring
|
||||
* the ones that might be mapped into the URI translation eventually, e.g. {@link org.springframework.web.bind.annotation.PathVariable} in the case of Spring
|
||||
* MVC. Note, that the return types of the methods have to be capable to be proxied.
|
||||
*
|
||||
* @param type must not be {@literal null}.
|
||||
|
||||
@@ -75,7 +75,7 @@ public class JsonPathLinkDiscoverer implements LinkDiscoverer {
|
||||
*
|
||||
* @param pathTemplate must not be {@literal null} or empty and contain a single placeholder.
|
||||
* @param mediaType the primary {@link MediaType}s to support.
|
||||
* @param additional {@link MediaTypes} to support.
|
||||
* @param others {@link MediaType}s to support.
|
||||
*/
|
||||
public JsonPathLinkDiscoverer(String pathTemplate, MediaType mediaType, MediaType... others) {
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public abstract class LinkBuilderSupport<T extends LinkBuilder> implements LinkB
|
||||
*/
|
||||
public T slash(Object object) {
|
||||
|
||||
object = Optional.class.isInstance(object) ? ((Optional<?>) object).orElse(null) : object;
|
||||
object = object instanceof Optional ? ((Optional<?>) object).orElse(null) : object;
|
||||
|
||||
if (object == null) {
|
||||
return getThis();
|
||||
|
||||
@@ -203,12 +203,12 @@ class HalFormsSerializers {
|
||||
|
||||
if (!(model.getHttpMethod() == HttpMethod.GET)) {
|
||||
|
||||
validate(resource, affordance, model);
|
||||
validate(resource, model);
|
||||
|
||||
HalFormsTemplate template = HalFormsTemplate.forMethod(model.getHttpMethod()) //
|
||||
.withProperties(model.getInputProperties());
|
||||
|
||||
/**
|
||||
/*
|
||||
* First template in HAL-FORMS is "default".
|
||||
*/
|
||||
templates.put(templates.isEmpty() ? "default" : model.getName(), template);
|
||||
@@ -221,12 +221,11 @@ class HalFormsSerializers {
|
||||
|
||||
/**
|
||||
* Verify that the resource's self link and the affordance's URI have the same relative path.
|
||||
*
|
||||
*
|
||||
* @param resource
|
||||
* @param affordance
|
||||
* @param model
|
||||
*/
|
||||
private static void validate(ResourceSupport resource, Affordance affordance, HalFormsAffordanceModel model) {
|
||||
private static void validate(ResourceSupport resource, HalFormsAffordanceModel model) {
|
||||
|
||||
String affordanceUri = model.getURI();
|
||||
String selfLinkUri = resource.getRequiredLink(IanaLinkRelation.SELF.value()).expand().getHref();
|
||||
|
||||
@@ -81,7 +81,7 @@ public abstract class IdentifiableResourceAssemblerSupport<T extends Identifiabl
|
||||
private Object[] unwrapIdentifyables(Object[] values) {
|
||||
|
||||
return Arrays.stream(values) //
|
||||
.map(element -> element instanceof Identifiable ? ((Identifiable<?>) element).getId() : element) //
|
||||
.map(element -> element instanceof Identifiable ? ((Identifiable<?>) element).getId().get() : element) //
|
||||
.toArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
|
||||
public class JacksonSerializers {
|
||||
|
||||
/**
|
||||
* Custom {@link JsonDeserializer} for Spring's {@link MediaType} using the {@link MediaType#paparseMediaType(String)}
|
||||
* Custom {@link JsonDeserializer} for Spring's {@link MediaType} using the {@link MediaType#parseMediaType(String)}
|
||||
* method.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
|
||||
@@ -109,7 +109,7 @@ public abstract class ResourceAssemblerSupport<T, D extends ResourceSupport> imp
|
||||
/**
|
||||
* Transform a list of {@code T}s into a list of {@link ResourceSupport}s.
|
||||
*
|
||||
* @see {@link #toListOfResources()} if you need this transformed list rendered as hypermedia
|
||||
* @see #toListOfResources() if you need this transformed list rendered as hypermedia
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -127,7 +127,7 @@ public abstract class ResourceAssemblerSupport<T, D extends ResourceSupport> imp
|
||||
/**
|
||||
* Converts all given entities into resources and wraps the result in a {@link Resources} instance.
|
||||
*
|
||||
* @see {@link #toListOfResources()}} and {@link ResourceAssembler#toResource(Object)}
|
||||
* @see #toListOfResources() and {@link ResourceAssembler#toResource(Object)}
|
||||
* @return
|
||||
*/
|
||||
public Resources<D> toResources() {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandler implements Handler
|
||||
}
|
||||
|
||||
// No post-processable type found - proceed with delegate
|
||||
if (!ResourceSupport.class.isInstance(value)) {
|
||||
if (!(value instanceof ResourceSupport)) {
|
||||
delegate.handleReturnValue(returnValue, returnType, mavContainer, webRequest);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class ResourceProcessorInvoker {
|
||||
*
|
||||
* @param processor must not be {@literal null}.
|
||||
*/
|
||||
public DefaultProcessorWrapper(ResourceProcessor<?> processor) {
|
||||
DefaultProcessorWrapper(ResourceProcessor<?> processor) {
|
||||
|
||||
Assert.notNull(processor, "Processor must not be null!");
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public class TypeReferences {
|
||||
private final Type type;
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "deprecation" })
|
||||
protected SyntheticParameterizedTypeReference() {
|
||||
SyntheticParameterizedTypeReference() {
|
||||
|
||||
Class<? extends SyntheticParameterizedTypeReference> foo = getClass();
|
||||
Type genericSuperclass = foo.getGenericSuperclass();
|
||||
@@ -154,7 +154,7 @@ public class TypeReferences {
|
||||
private final Type rawType;
|
||||
private final Type[] typeArguments;
|
||||
|
||||
public SyntheticParameterizedType(Type rawType, Type... typeArguments) {
|
||||
SyntheticParameterizedType(Type rawType, Type... typeArguments) {
|
||||
|
||||
this.rawType = rawType;
|
||||
this.typeArguments = typeArguments;
|
||||
|
||||
Reference in New Issue
Block a user