parent
5c5c89e9fe
commit
a892ce80c1
|
@ -143,13 +143,12 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
|
|||
Advice advice = this.advisor.getAdvice();
|
||||
StringBuilder sb = new StringBuilder(ClassUtils.getShortName(advice.getClass()));
|
||||
boolean appended = false;
|
||||
if (this.advisor instanceof Ordered) {
|
||||
sb.append(": order = ").append(((Ordered) this.advisor).getOrder());
|
||||
if (this.advisor instanceof Ordered ordered) {
|
||||
sb.append(": order = ").append(ordered.getOrder());
|
||||
appended = true;
|
||||
}
|
||||
if (advice instanceof AbstractAspectJAdvice) {
|
||||
if (advice instanceof AbstractAspectJAdvice ajAdvice) {
|
||||
sb.append(!appended ? ": " : ", ");
|
||||
AbstractAspectJAdvice ajAdvice = (AbstractAspectJAdvice) advice;
|
||||
sb.append("aspect name = ");
|
||||
sb.append(ajAdvice.getAspectName());
|
||||
sb.append(", declaration order = ");
|
||||
|
|
|
@ -556,7 +556,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
|||
logger.debug("Refreshing target with name '" + this.targetName + "'");
|
||||
}
|
||||
Object target = this.beanFactory.getBean(this.targetName);
|
||||
return (target instanceof TargetSource ? (TargetSource) target : new SingletonTargetSource(target));
|
||||
return (target instanceof TargetSource targetSource ? targetSource : new SingletonTargetSource(target));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,8 +80,8 @@ public abstract class ScopedProxyUtils {
|
|||
// Copy autowire settings from original bean definition.
|
||||
proxyDefinition.setAutowireCandidate(targetDefinition.isAutowireCandidate());
|
||||
proxyDefinition.setPrimary(targetDefinition.isPrimary());
|
||||
if (targetDefinition instanceof AbstractBeanDefinition) {
|
||||
proxyDefinition.copyQualifiersFrom((AbstractBeanDefinition) targetDefinition);
|
||||
if (targetDefinition instanceof AbstractBeanDefinition abd) {
|
||||
proxyDefinition.copyQualifiersFrom(abd);
|
||||
}
|
||||
|
||||
// The target bean should be ignored in favor of the scoped proxy.
|
||||
|
|
|
@ -52,8 +52,8 @@ public abstract class AbstractPointcutAdvisor implements PointcutAdvisor, Ordere
|
|||
return this.order;
|
||||
}
|
||||
Advice advice = getAdvice();
|
||||
if (advice instanceof Ordered) {
|
||||
return ((Ordered) advice).getOrder();
|
||||
if (advice instanceof Ordered ordered) {
|
||||
return ordered.getOrder();
|
||||
}
|
||||
return Ordered.LOWEST_PRECEDENCE;
|
||||
}
|
||||
|
|
|
@ -841,7 +841,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
|||
PropertyTokenHolder tokens = getPropertyNameTokens(nestedProperty);
|
||||
String canonicalName = tokens.canonicalName;
|
||||
Object value = getPropertyValue(tokens);
|
||||
if (value == null || (value instanceof Optional && !((Optional<?>) value).isPresent())) {
|
||||
if (value == null || (value instanceof Optional<?> optional && optional.isEmpty()) {
|
||||
if (isAutoGrowNestedPaths()) {
|
||||
value = setDefaultValue(tokens);
|
||||
}
|
||||
|
|
|
@ -162,9 +162,8 @@ public abstract class BeanFactoryUtils {
|
|||
Assert.notNull(lbf, "ListableBeanFactory must not be null");
|
||||
String[] result = lbf.getBeanNamesForType(type);
|
||||
if (lbf instanceof HierarchicalBeanFactory hbf) {
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
String[] parentResult = beanNamesForTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type);
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory pbf) {
|
||||
String[] parentResult = beanNamesForTypeIncludingAncestors(pbf, type);
|
||||
result = mergeNamesWithParent(result, parentResult, hbf);
|
||||
}
|
||||
}
|
||||
|
@ -225,9 +224,8 @@ public abstract class BeanFactoryUtils {
|
|||
Assert.notNull(lbf, "ListableBeanFactory must not be null");
|
||||
String[] result = lbf.getBeanNamesForType(type);
|
||||
if (lbf instanceof HierarchicalBeanFactory hbf) {
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
String[] parentResult = beanNamesForTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type);
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory pbf) {
|
||||
String[] parentResult = beanNamesForTypeIncludingAncestors(pbf, type);
|
||||
result = mergeNamesWithParent(result, parentResult, hbf);
|
||||
}
|
||||
}
|
||||
|
@ -371,9 +369,8 @@ public abstract class BeanFactoryUtils {
|
|||
Map<String, T> result = new LinkedHashMap<>(4);
|
||||
result.putAll(lbf.getBeansOfType(type, includeNonSingletons, allowEagerInit));
|
||||
if (lbf instanceof HierarchicalBeanFactory hbf) {
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
Map<String, T> parentResult = beansOfTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type, includeNonSingletons, allowEagerInit);
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory pbf) {
|
||||
Map<String, T> parentResult = beansOfTypeIncludingAncestors(pbf, type, includeNonSingletons, allowEagerInit);
|
||||
parentResult.forEach((beanName, beanInstance) -> {
|
||||
if (!result.containsKey(beanName) && !hbf.containsLocalBean(beanName)) {
|
||||
result.put(beanName, beanInstance);
|
||||
|
|
|
@ -286,9 +286,8 @@ public class HandlerMethod {
|
|||
*/
|
||||
public HandlerMethod createWithResolvedBean() {
|
||||
Object handler = this.bean;
|
||||
if (this.bean instanceof String) {
|
||||
if (this.bean instanceof String beanName) {
|
||||
Assert.state(this.beanFactory != null, "Cannot resolve bean name without BeanFactory");
|
||||
String beanName = (String) this.bean;
|
||||
handler = this.beanFactory.getBean(beanName);
|
||||
}
|
||||
return new HandlerMethod(this, handler);
|
||||
|
|
|
@ -692,7 +692,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
|||
return true;
|
||||
}
|
||||
else if (HttpHeaders.CONTENT_LENGTH.equalsIgnoreCase(name)) {
|
||||
setContentLength(value instanceof Number ? ((Number) value).intValue() :
|
||||
setContentLength(value instanceof Number number ? number.intValue() :
|
||||
Integer.parseInt(value.toString()));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -549,8 +549,8 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
|||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
if (beanFactory instanceof ConfigurableBeanFactory) {
|
||||
this.beanFactory = (ConfigurableBeanFactory) beanFactory;
|
||||
if (beanFactory instanceof ConfigurableBeanFactory cbf) {
|
||||
this.beanFactory = cbf;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1010,8 +1010,8 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
|||
if (!mavContainer.isViewReference()) {
|
||||
mav.setView((View) mavContainer.getView());
|
||||
}
|
||||
if (model instanceof RedirectAttributes) {
|
||||
Map<String, ?> flashAttributes = ((RedirectAttributes) model).getFlashAttributes();
|
||||
if (model instanceof RedirectAttributes redirectAttributes) {
|
||||
Map<String, ?> flashAttributes = redirectAttributes.getFlashAttributes();
|
||||
HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
|
||||
if (request != null) {
|
||||
RequestContextUtils.getOutputFlashMap(request).putAll(flashAttributes);
|
||||
|
|
Loading…
Reference in New Issue