Use Class#componentType() for consistency with arrayType()

Java 12 introduced java.lang.Class#componentType() as a shortcut for
getComponentType().

Since we started using arrayType() in fe5560400c, this commit switches
to componentType() for consistent API usage style.
This commit is contained in:
Sam Brannen
2023-08-07 12:43:40 +03:00
parent 96fd3c10fb
commit 526fc391ee
40 changed files with 88 additions and 88 deletions

View File

@@ -344,7 +344,7 @@ public class WebDataBinder extends DataBinder {
}
else if (fieldType.isArray()) {
// Special handling of array property.
return Array.newInstance(fieldType.getComponentType(), 0);
return Array.newInstance(fieldType.componentType(), 0);
}
else if (Collection.class.isAssignableFrom(fieldType)) {
return CollectionFactory.createCollection(fieldType, 0);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2023 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.
@@ -157,7 +157,7 @@ public final class MultipartResolutionDelegate {
}
private static boolean isMultipartFileArray(MethodParameter methodParam) {
return (MultipartFile.class == methodParam.getNestedParameterType().getComponentType());
return (MultipartFile.class == methodParam.getNestedParameterType().componentType());
}
private static boolean isPartCollection(MethodParameter methodParam) {
@@ -165,7 +165,7 @@ public final class MultipartResolutionDelegate {
}
private static boolean isPartArray(MethodParameter methodParam) {
return (Part.class == methodParam.getNestedParameterType().getComponentType());
return (Part.class == methodParam.getNestedParameterType().componentType());
}
@Nullable