mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-30 06:09:14 +00:00
Polish code to use instanceof pattern matching in conditions
See gh-50419 Signed-off-by: Vinod Kumar <codingkiddo@gmail.com>
This commit is contained in:
committed by
Phillip Webb
parent
c66ea41367
commit
8dfdb2452f
+2
-2
@@ -165,8 +165,8 @@ public final class ConditionEvaluationReport {
|
||||
* @return the {@link ConditionEvaluationReport} or {@code null}
|
||||
*/
|
||||
public static ConditionEvaluationReport find(BeanFactory beanFactory) {
|
||||
if (beanFactory instanceof ConfigurableListableBeanFactory) {
|
||||
return ConditionEvaluationReport.get((ConfigurableListableBeanFactory) beanFactory);
|
||||
if (beanFactory instanceof ConfigurableListableBeanFactory configurableListableBeanFactory) {
|
||||
return ConditionEvaluationReport.get(configurableListableBeanFactory);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+2
-2
@@ -659,8 +659,8 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
|
||||
}
|
||||
|
||||
private Set<BeanType> deducedBeanType(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
if (metadata instanceof MethodMetadata && metadata.isAnnotated(Bean.class.getName())) {
|
||||
return deducedBeanTypeForBeanMethod(context, (MethodMetadata) metadata);
|
||||
if (metadata instanceof MethodMetadata methodMetadata && metadata.isAnnotated(Bean.class.getName())) {
|
||||
return deducedBeanTypeForBeanMethod(context, methodMetadata);
|
||||
}
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user