mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Polishing
This commit is contained in:
+2
-3
@@ -291,7 +291,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
|||||||
String lastKey = tokens.keys[tokens.keys.length - 1];
|
String lastKey = tokens.keys[tokens.keys.length - 1];
|
||||||
|
|
||||||
if (propValue.getClass().isArray()) {
|
if (propValue.getClass().isArray()) {
|
||||||
Class<?> requiredType = propValue.getClass().componentType();
|
Class<?> componentType = propValue.getClass().componentType();
|
||||||
int arrayIndex = Integer.parseInt(lastKey);
|
int arrayIndex = Integer.parseInt(lastKey);
|
||||||
Object oldValue = null;
|
Object oldValue = null;
|
||||||
try {
|
try {
|
||||||
@@ -299,10 +299,9 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
|||||||
oldValue = Array.get(propValue, arrayIndex);
|
oldValue = Array.get(propValue, arrayIndex);
|
||||||
}
|
}
|
||||||
Object convertedValue = convertIfNecessary(tokens.canonicalName, oldValue, pv.getValue(),
|
Object convertedValue = convertIfNecessary(tokens.canonicalName, oldValue, pv.getValue(),
|
||||||
requiredType, ph.nested(tokens.keys.length));
|
componentType, ph.nested(tokens.keys.length));
|
||||||
int length = Array.getLength(propValue);
|
int length = Array.getLength(propValue);
|
||||||
if (arrayIndex >= length && arrayIndex < this.autoGrowCollectionLimit) {
|
if (arrayIndex >= length && arrayIndex < this.autoGrowCollectionLimit) {
|
||||||
Class<?> componentType = propValue.getClass().componentType();
|
|
||||||
Object newArray = Array.newInstance(componentType, arrayIndex + 1);
|
Object newArray = Array.newInstance(componentType, arrayIndex + 1);
|
||||||
System.arraycopy(propValue, 0, newArray, 0, length);
|
System.arraycopy(propValue, 0, newArray, 0, length);
|
||||||
int lastKeyIndex = tokens.canonicalName.lastIndexOf('[');
|
int lastKeyIndex = tokens.canonicalName.lastIndexOf('[');
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -85,12 +85,13 @@ public class SingleColumnRowMapper<T> implements RowMapper<T> {
|
|||||||
* Set a {@link ConversionService} for converting a fetched value.
|
* Set a {@link ConversionService} for converting a fetched value.
|
||||||
* <p>Default is the {@link DefaultConversionService}.
|
* <p>Default is the {@link DefaultConversionService}.
|
||||||
* @since 5.0.4
|
* @since 5.0.4
|
||||||
* @see DefaultConversionService#getSharedInstance
|
* @see DefaultConversionService#getSharedInstance()
|
||||||
*/
|
*/
|
||||||
public void setConversionService(@Nullable ConversionService conversionService) {
|
public void setConversionService(@Nullable ConversionService conversionService) {
|
||||||
this.conversionService = conversionService;
|
this.conversionService = conversionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract a value for the single column in the current row.
|
* Extract a value for the single column in the current row.
|
||||||
* <p>Validates that there is only one column selected,
|
* <p>Validates that there is only one column selected,
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -48,8 +48,8 @@ public class DestinationVariableArgumentResolver implements RSocketServiceArgume
|
|||||||
collection.forEach(requestValues::addRouteVariable);
|
collection.forEach(requestValues::addRouteVariable);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (argument.getClass().isArray()) {
|
else if (argument instanceof Object[] arguments) {
|
||||||
for (Object variable : (Object[]) argument) {
|
for (Object variable : arguments) {
|
||||||
requestValues.addRouteVariable(variable);
|
requestValues.addRouteVariable(variable);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -139,6 +139,7 @@ final class DefaultRestClient implements RestClient {
|
|||||||
this.builder = builder;
|
this.builder = builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RequestHeadersUriSpec<?> get() {
|
public RequestHeadersUriSpec<?> get() {
|
||||||
return methodInternal(HttpMethod.GET);
|
return methodInternal(HttpMethod.GET);
|
||||||
@@ -272,8 +273,6 @@ final class DefaultRestClient implements RestClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private class DefaultRequestBodyUriSpec implements RequestBodyUriSpec {
|
private class DefaultRequestBodyUriSpec implements RequestBodyUriSpec {
|
||||||
|
|
||||||
private final HttpMethod httpMethod;
|
private final HttpMethod httpMethod;
|
||||||
@@ -452,7 +451,6 @@ final class DefaultRestClient implements RestClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseSpec retrieve() {
|
public ResponseSpec retrieve() {
|
||||||
ResponseSpec responseSpec = exchangeInternal(DefaultResponseSpec::new, false);
|
ResponseSpec responseSpec = exchangeInternal(DefaultResponseSpec::new, false);
|
||||||
@@ -784,8 +782,6 @@ final class DefaultRestClient implements RestClient {
|
|||||||
this.observationScope.close();
|
this.observationScope.close();
|
||||||
this.observation.stop();
|
this.observation.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -217,11 +217,10 @@ public abstract class AbstractMultiCheckedElementTag extends AbstractCheckedElem
|
|||||||
throw new IllegalArgumentException("Attribute 'items' is required and must be a Collection, an Array or a Map");
|
throw new IllegalArgumentException("Attribute 'items' is required and must be a Collection, an Array or a Map");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemsObject.getClass().isArray()) {
|
if (itemsObject instanceof Object[] itemsArray) {
|
||||||
Object[] itemsArray = (Object[]) itemsObject;
|
for (int itemIndex = 0; itemIndex < itemsArray.length; itemIndex++) {
|
||||||
for (int i = 0; i < itemsArray.length; i++) {
|
Object item = itemsArray[itemIndex];
|
||||||
Object item = itemsArray[i];
|
writeObjectEntry(tagWriter, valueProperty, labelProperty, item, itemIndex);
|
||||||
writeObjectEntry(tagWriter, valueProperty, labelProperty, item, i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (itemsObject instanceof Collection<?> optionCollection) {
|
else if (itemsObject instanceof Collection<?> optionCollection) {
|
||||||
|
|||||||
Reference in New Issue
Block a user