Polishing

This commit is contained in:
Sam Brannen
2024-01-30 16:24:55 +01:00
parent 3a518b60e7
commit 398cc01650
2 changed files with 5 additions and 8 deletions

View File

@@ -59,11 +59,9 @@ class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware {
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
if (beanFactory instanceof ConfigurableBeanFactory) {
Object typeConverter = ((ConfigurableBeanFactory) beanFactory).getTypeConverter();
if (typeConverter instanceof SimpleTypeConverter) {
delegate = (SimpleTypeConverter) typeConverter;
}
if (beanFactory instanceof ConfigurableBeanFactory cbf &&
cbf.getTypeConverter() instanceof SimpleTypeConverter simpleTypeConverter) {
this.delegate = simpleTypeConverter;
}
}
@@ -86,7 +84,6 @@ class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware {
if (conversionService.canConvert(sourceTypeDescriptor, targetTypeDescriptor)) {
return true;
}
// TODO: what does this mean? This method is not used in SpEL so probably ignorable?
Class<?> sourceType = sourceTypeDescriptor.getObjectType();
Class<?> targetType = targetTypeDescriptor.getObjectType();
return canConvert(sourceType, targetType);