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

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2024 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.
@ -53,7 +53,7 @@ import org.springframework.web.server.ServerWebExchange;
* {@code HandlerResultHandler} that encapsulates the view resolution algorithm * {@code HandlerResultHandler} that encapsulates the view resolution algorithm
* supporting the following return types: * supporting the following return types:
* <ul> * <ul>
* <li>{@link Void} or no value -- default view name</li> * <li>{@link Void}, {@code void}, or no value -- default view name</li>
* <li>{@link String} -- view name unless {@code @ModelAttribute}-annotated * <li>{@link String} -- view name unless {@code @ModelAttribute}-annotated
* <li>{@link View} -- View to render with * <li>{@link View} -- View to render with
* <li>{@link Model} -- attributes to add to the model * <li>{@link Model} -- attributes to add to the model