#831 - Polishing.

This commit is contained in:
Greg Turnquist
2019-03-11 17:16:01 -05:00
parent bdd602aa74
commit 520fdc8d91
10 changed files with 15 additions and 13 deletions

View File

@@ -242,8 +242,9 @@ public class Link implements Serializable {
String name = httpMethod.toString().toLowerCase();
if (inputType.resolve() != null) {
name += inputType.resolve().getSimpleName();
Class<?> resolvedInputType = inputType.resolve();
if (resolvedInputType != null) {
name += resolvedInputType.getSimpleName();
}
return andAffordance(name, httpMethod, inputType, queryMethodParameters, outputType);

View File

@@ -161,7 +161,7 @@ public class JsonPathLinkDiscoverer implements LinkDiscoverer {
*/
private Links createLinksFrom(Object parseResult, LinkRelation rel) {
if (parseResult instanceof JSONArray) {
if (JSONArray.class.isInstance(parseResult)) {
JSONArray jsonArray = (JSONArray) parseResult;

View File

@@ -110,7 +110,7 @@ class WebMvcHateoasConfiguration {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (!(bean instanceof RestTemplate)) {
if (!(RestTemplate.class.isInstance(bean))) {
return bean;
}

View File

@@ -798,7 +798,7 @@ class Jackson2CollectionJsonModule extends SimpleModule {
return resources.getContent().stream().map(content -> {
if (!(content instanceof EntityModel)) {
if (!(EntityModel.class.isInstance(content))) {
return new CollectionJsonItem<>().withRawData(content);
}

View File

@@ -51,7 +51,7 @@ public class HalLinkDiscoverer extends JsonPathLinkDiscoverer {
@SuppressWarnings("unchecked")
protected Link extractLink(Object element, LinkRelation rel) {
if (!(element instanceof Map)) {
if (!(Map.class.isInstance(element))) {
return super.extractLink(element, rel);
}

View File

@@ -58,7 +58,7 @@ public class HalLinkRelation implements LinkRelation, MessageSourceResolvable {
Assert.notNull(relation, "LinkRelation must not be null!");
if (relation instanceof HalLinkRelation) {
if (HalLinkRelation.class.isInstance(relation)) {
return (HalLinkRelation) relation;
}

View File

@@ -431,7 +431,7 @@ public class Jackson2HalModule extends SimpleModule {
Object firstElement = list.get(0);
if (!(firstElement instanceof HalLink)) {
if (!(HalLink.class.isInstance(firstElement))) {
serializeContents(list, jgen, provider);
return;
}

View File

@@ -38,7 +38,7 @@ public class UriTemplateFactory {
* @param mapping must not be {@literal null} or empty.
* @return
*/
public static UriTemplate templateFor(String mapping) {
public static UriTemplate templateFor(@Nullable String mapping) {
Assert.hasText(mapping, "Mapping must not be null or empty!");

View File

@@ -320,7 +320,7 @@ public class WebHandler {
* @param attribute must not be {@literal null}.
* @return
*/
protected BoundMethodParameter createParameter(MethodParameter parameter, Object value,
protected BoundMethodParameter createParameter(MethodParameter parameter, @Nullable Object value,
AnnotationAttribute attribute) {
return new BoundMethodParameter(parameter, value, attribute);
}
@@ -370,7 +370,7 @@ public class WebHandler {
* @param value can be {@literal null}.
* @param attribute can be {@literal null}.
*/
public BoundMethodParameter(MethodParameter parameter, Object value, AnnotationAttribute attribute) {
public BoundMethodParameter(MethodParameter parameter, @Nullable Object value, AnnotationAttribute attribute) {
Assert.notNull(parameter, "MethodParameter must not be null!");
@@ -404,6 +404,7 @@ public class WebHandler {
*
* @return
*/
@Nullable
public Object getValue() {
return value;
}

View File

@@ -293,8 +293,8 @@ public class RepresentationModelProcessorInvoker {
* Returns whether the given {@link EntityModel} matches the given target {@link ResolvableType}. We inspect the
* {@link EntityModel}'s value to determine the match.
*
* @param resource
* @param target must not be {@literal null}.
* @param resource can be {@literal null}.
* @param target can be {@literal null}.
* @return whether the given {@link EntityModel} can be assigned to the given target {@link ResolvableType}
*/
private static boolean isValueTypeMatch(@Nullable EntityModel<?> resource, @Nullable ResolvableType target) {