1
0
mirror of synced 2026-05-22 21:33:16 +00:00

Simplify condition in some methods

This commit is contained in:
Tran Ngoc Nhan
2024-10-25 19:41:26 +07:00
committed by Josh Cummings
parent e76de931ce
commit ab93541926
7 changed files with 15 additions and 39 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 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.
@@ -43,12 +43,9 @@ final class ObjectToListStringConverter implements ConditionalGenericConverter {
@Override
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
if (targetType.getElementTypeDescriptor() == null
|| targetType.getElementTypeDescriptor().getType().equals(String.class) || sourceType == null
|| ClassUtils.isAssignable(sourceType.getType(), targetType.getElementTypeDescriptor().getType())) {
return true;
}
return false;
TypeDescriptor typeDescriptor = targetType.getElementTypeDescriptor();
return typeDescriptor == null || typeDescriptor.getType().equals(String.class) || sourceType == null
|| ClassUtils.isAssignable(sourceType.getType(), typeDescriptor.getType());
}
@Override
@@ -37,11 +37,8 @@ final class ObjectToMapStringObjectConverter implements ConditionalGenericConver
@Override
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
if (targetType.getElementTypeDescriptor() == null
|| targetType.getMapKeyTypeDescriptor().getType().equals(String.class)) {
return true;
}
return false;
return targetType.getElementTypeDescriptor() == null
|| targetType.getMapKeyTypeDescriptor().getType().equals(String.class);
}
@Override