Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Jan 30, 2024
1 parent 3a518b6 commit 398cc01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ public void setConversionService(ConversionService conversionService) {

@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;
}
}

Expand All @@ -86,7 +84,6 @@ public boolean canConvert(TypeDescriptor sourceTypeDescriptor, TypeDescriptor ta
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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -53,7 +53,7 @@
* {@code HandlerResultHandler} that encapsulates the view resolution algorithm
* supporting the following return types:
* <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 View} -- View to render with
* <li>{@link Model} -- attributes to add to the model
Expand Down

0 comments on commit 398cc01

Please sign in to comment.