Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
||||
@@ -133,11 +133,11 @@ class DefaultClientResponse implements ClientResponse {
|
||||
public <T> T body(BodyExtractor<T, ? super ClientHttpResponse> extractor) {
|
||||
T result = extractor.extract(this.response, this.bodyExtractorContext);
|
||||
String description = "Body from " + this.requestDescription + " [DefaultClientResponse]";
|
||||
if (result instanceof Mono<?> monoResult) {
|
||||
return (T) monoResult.checkpoint(description);
|
||||
if (result instanceof Mono<?> mono) {
|
||||
return (T) mono.checkpoint(description);
|
||||
}
|
||||
else if (result instanceof Flux<?> fluxResult) {
|
||||
return (T) fluxResult.checkpoint(description);
|
||||
else if (result instanceof Flux<?> flux) {
|
||||
return (T) flux.checkpoint(description);
|
||||
}
|
||||
else {
|
||||
return result;
|
||||
|
||||
@@ -107,7 +107,7 @@ final class DefaultRenderingResponseBuilder implements RenderingResponse.Builder
|
||||
@Override
|
||||
public RenderingResponse.Builder modelAttribute(Object attribute) {
|
||||
Assert.notNull(attribute, "Attribute must not be null");
|
||||
if (attribute instanceof Collection<?> attrCollection && attrCollection.isEmpty()) {
|
||||
if (attribute instanceof Collection<?> collection && collection.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
return modelAttribute(Conventions.getVariableName(attribute), attribute);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -247,7 +247,7 @@ public class ModelAttributeMethodArgumentResolver extends HandlerMethodArgumentR
|
||||
}
|
||||
}
|
||||
}
|
||||
value = (value instanceof List<?> valueList ? valueList.toArray() : value);
|
||||
value = (value instanceof List<?> list ? list.toArray() : value);
|
||||
MethodParameter methodParam = new MethodParameter(ctor, i);
|
||||
if (value == null && methodParam.isOptional()) {
|
||||
args[i] = (methodParam.getParameterType() == Optional.class ? Optional.empty() : null);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -177,8 +177,8 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
|
||||
@Nullable
|
||||
private RequestMappingInfo createRequestMappingInfo(AnnotatedElement element) {
|
||||
RequestMapping requestMapping = AnnotatedElementUtils.findMergedAnnotation(element, RequestMapping.class);
|
||||
RequestCondition<?> condition = (element instanceof Class<?> typeElement ?
|
||||
getCustomTypeCondition(typeElement) : getCustomMethodCondition((Method) element));
|
||||
RequestCondition<?> condition = (element instanceof Class<?> clazz ?
|
||||
getCustomTypeCondition(clazz) : getCustomMethodCondition((Method) element));
|
||||
return (requestMapping != null ? createRequestMappingInfo(requestMapping, condition) : null);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -126,8 +126,8 @@ public class BindStatus {
|
||||
this.objectErrors = this.errors.getFieldErrors(this.expression);
|
||||
this.value = this.errors.getFieldValue(this.expression);
|
||||
this.valueType = this.errors.getFieldType(this.expression);
|
||||
if (this.errors instanceof BindingResult bindingResultError) {
|
||||
this.bindingResult = bindingResultError;
|
||||
if (this.errors instanceof BindingResult br) {
|
||||
this.bindingResult = br;
|
||||
this.actualValue = this.bindingResult.getRawFieldValue(this.expression);
|
||||
this.editor = this.bindingResult.findEditor(this.expression, null);
|
||||
}
|
||||
@@ -162,8 +162,8 @@ public class BindStatus {
|
||||
this.errorMessages = new String[0];
|
||||
}
|
||||
|
||||
if (htmlEscape && this.value instanceof String valueString) {
|
||||
this.value = HtmlUtils.htmlEscape(valueString);
|
||||
if (htmlEscape && this.value instanceof String text) {
|
||||
this.value = HtmlUtils.htmlEscape(text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,8 +238,8 @@ public class BindStatus {
|
||||
* will get HTML-escaped.
|
||||
*/
|
||||
public String getDisplayValue() {
|
||||
if (this.value instanceof String stringValue) {
|
||||
return stringValue;
|
||||
if (this.value instanceof String displayValue) {
|
||||
return displayValue;
|
||||
}
|
||||
if (this.value != null) {
|
||||
return (this.htmlEscape ?
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
||||
@@ -223,7 +223,7 @@ public class ViewResolutionResultHandler extends HandlerResultHandlerSupport imp
|
||||
if (view == null) {
|
||||
view = getDefaultViewName(exchange);
|
||||
}
|
||||
viewsMono = (view instanceof String stringView? resolveViews(stringView, locale) :
|
||||
viewsMono = (view instanceof String viewName ? resolveViews(viewName, locale) :
|
||||
Mono.just(Collections.singletonList((View) view)));
|
||||
}
|
||||
else if (Model.class.isAssignableFrom(clazz)) {
|
||||
|
||||
Reference in New Issue
Block a user