Skip to content

Commit bf31f71

Browse files
committed
Polishing
(cherry picked from commit a3a4344)
1 parent 249d837 commit bf31f71

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

spring-beans/src/main/java/org/springframework/beans/BeanUtils.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public abstract class BeanUtils {
5757

5858
private static final Log logger = LogFactory.getLog(BeanUtils.class);
5959

60-
// using WeakHashMap as a Set
60+
// Effectively using a WeakHashMap as a Set
6161
private static final Map<Class<?>, Boolean> unknownEditorTypes =
6262
Collections.synchronizedMap(new WeakHashMap<Class<?>, Boolean>());
6363

@@ -127,7 +127,7 @@ public static <T> T instantiateClass(Class<T> clazz) throws BeanInstantiationExc
127127
@SuppressWarnings("unchecked")
128128
public static <T> T instantiateClass(Class<?> clazz, Class<T> assignableTo) throws BeanInstantiationException {
129129
Assert.isAssignable(assignableTo, clazz);
130-
return (T)instantiateClass(clazz);
130+
return (T) instantiateClass(clazz);
131131
}
132132

133133
/**
@@ -281,7 +281,7 @@ public static Method findMethodWithMinimalParameters(Method[] methods, String me
281281
}
282282
else {
283283
if (targetMethod.getParameterTypes().length == numParams) {
284-
// Additional candidate with same length.
284+
// Additional candidate with same length
285285
numMethodsFoundWithCurrentMinimumArgs++;
286286
}
287287
}
@@ -317,10 +317,8 @@ public static Method findMethodWithMinimalParameters(Method[] methods, String me
317317
public static Method resolveSignature(String signature, Class<?> clazz) {
318318
Assert.hasText(signature, "'signature' must not be empty");
319319
Assert.notNull(clazz, "Class must not be null");
320-
321320
int firstParen = signature.indexOf("(");
322321
int lastParen = signature.indexOf(")");
323-
324322
if (firstParen > -1 && lastParen == -1) {
325323
throw new IllegalArgumentException("Invalid method signature '" + signature +
326324
"': expected closing ')' for args list");
@@ -336,7 +334,7 @@ else if (firstParen == -1 && lastParen == -1) {
336334
String methodName = signature.substring(0, firstParen);
337335
String[] parameterTypeNames =
338336
StringUtils.commaDelimitedListToStringArray(signature.substring(firstParen + 1, lastParen));
339-
Class<?>[] parameterTypes = new Class[parameterTypeNames.length];
337+
Class<?>[] parameterTypes = new Class<?>[parameterTypeNames.length];
340338
for (int i = 0; i < parameterTypeNames.length; i++) {
341339
String parameterTypeName = parameterTypeNames[i].trim();
342340
try {
@@ -475,8 +473,7 @@ public static Class<?> findPropertyType(String propertyName, Class<?>... beanCla
475473
*/
476474
public static MethodParameter getWriteMethodParameter(PropertyDescriptor pd) {
477475
if (pd instanceof GenericTypeAwarePropertyDescriptor) {
478-
return new MethodParameter(
479-
((GenericTypeAwarePropertyDescriptor) pd).getWriteMethodParameter());
476+
return new MethodParameter(((GenericTypeAwarePropertyDescriptor) pd).getWriteMethodParameter());
480477
}
481478
else {
482479
return new MethodParameter(pd.getWriteMethod(), 0);
@@ -545,9 +542,7 @@ public static void copyProperties(Object source, Object target) throws BeansExce
545542
* @throws BeansException if the copying failed
546543
* @see BeanWrapper
547544
*/
548-
public static void copyProperties(Object source, Object target, Class<?> editable)
549-
throws BeansException {
550-
545+
public static void copyProperties(Object source, Object target, Class<?> editable) throws BeansException {
551546
copyProperties(source, target, editable, (String[]) null);
552547
}
553548

@@ -565,9 +560,7 @@ public static void copyProperties(Object source, Object target, Class<?> editabl
565560
* @throws BeansException if the copying failed
566561
* @see BeanWrapper
567562
*/
568-
public static void copyProperties(Object source, Object target, String... ignoreProperties)
569-
throws BeansException {
570-
563+
public static void copyProperties(Object source, Object target, String... ignoreProperties) throws BeansException {
571564
copyProperties(source, target, null, ignoreProperties);
572565
}
573566

0 commit comments

Comments
 (0)