Polishing (collapsed if checks, consistent downcasts, refined javadoc)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -105,10 +105,8 @@ class ConditionEvaluator {
|
||||
if (condition instanceof ConfigurationCondition) {
|
||||
requiredPhase = ((ConfigurationCondition) condition).getConfigurationPhase();
|
||||
}
|
||||
if (requiredPhase == null || requiredPhase == phase) {
|
||||
if (!condition.matches(this.context, metadata)) {
|
||||
return true;
|
||||
}
|
||||
if ((requiredPhase == null || requiredPhase == phase) && !condition.matches(this.context, metadata)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -351,10 +351,8 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
||||
while (!candidates.isEmpty());
|
||||
|
||||
// Register the ImportRegistry as a bean in order to support ImportAware @Configuration classes
|
||||
if (sbr != null) {
|
||||
if (!sbr.containsSingleton(IMPORT_REGISTRY_BEAN_NAME)) {
|
||||
sbr.registerSingleton(IMPORT_REGISTRY_BEAN_NAME, parser.getImportRegistry());
|
||||
}
|
||||
if (sbr != null && !sbr.containsSingleton(IMPORT_REGISTRY_BEAN_NAME)) {
|
||||
sbr.registerSingleton(IMPORT_REGISTRY_BEAN_NAME, parser.getImportRegistry());
|
||||
}
|
||||
|
||||
if (this.metadataReaderFactory instanceof CachingMetadataReaderFactory) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -362,10 +362,9 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
||||
}
|
||||
for (ResolvableType declaredEventType : this.declaredEventTypes) {
|
||||
Class<?> eventClass = declaredEventType.getRawClass();
|
||||
if ((eventClass == null || !ApplicationEvent.class.isAssignableFrom(eventClass)) && payloadType != null) {
|
||||
if (declaredEventType.isAssignableFrom(payloadType)) {
|
||||
return declaredEventType;
|
||||
}
|
||||
if ((eventClass == null || !ApplicationEvent.class.isAssignableFrom(eventClass)) &&
|
||||
payloadType != null && declaredEventType.isAssignableFrom(payloadType)) {
|
||||
return declaredEventType;
|
||||
}
|
||||
if (declaredEventType.getRawClass().isInstance(event)) {
|
||||
return declaredEventType;
|
||||
|
||||
@@ -363,25 +363,23 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
|
||||
|
||||
ModelMBeanOperationInfo info = null;
|
||||
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
|
||||
if (pd != null) {
|
||||
if ((method.equals(pd.getReadMethod()) && includeReadAttribute(method, beanKey)) ||
|
||||
(method.equals(pd.getWriteMethod()) && includeWriteAttribute(method, beanKey))) {
|
||||
// Attributes need to have their methods exposed as
|
||||
// operations to the JMX server as well.
|
||||
info = createModelMBeanOperationInfo(method, pd.getName(), beanKey);
|
||||
Descriptor desc = info.getDescriptor();
|
||||
if (method.equals(pd.getReadMethod())) {
|
||||
desc.setField(FIELD_ROLE, ROLE_GETTER);
|
||||
}
|
||||
else {
|
||||
desc.setField(FIELD_ROLE, ROLE_SETTER);
|
||||
}
|
||||
desc.setField(FIELD_VISIBILITY, ATTRIBUTE_OPERATION_VISIBILITY);
|
||||
if (isExposeClassDescriptor()) {
|
||||
desc.setField(FIELD_CLASS, getClassForDescriptor(managedBean).getName());
|
||||
}
|
||||
info.setDescriptor(desc);
|
||||
if (pd != null && ((method.equals(pd.getReadMethod()) && includeReadAttribute(method, beanKey)) ||
|
||||
(method.equals(pd.getWriteMethod()) && includeWriteAttribute(method, beanKey)))) {
|
||||
// Attributes need to have their methods exposed as
|
||||
// operations to the JMX server as well.
|
||||
info = createModelMBeanOperationInfo(method, pd.getName(), beanKey);
|
||||
Descriptor desc = info.getDescriptor();
|
||||
if (method.equals(pd.getReadMethod())) {
|
||||
desc.setField(FIELD_ROLE, ROLE_GETTER);
|
||||
}
|
||||
else {
|
||||
desc.setField(FIELD_ROLE, ROLE_SETTER);
|
||||
}
|
||||
desc.setField(FIELD_VISIBILITY, ATTRIBUTE_OPERATION_VISIBILITY);
|
||||
if (isExposeClassDescriptor()) {
|
||||
desc.setField(FIELD_CLASS, getClassForDescriptor(managedBean).getName());
|
||||
}
|
||||
info.setDescriptor(desc);
|
||||
}
|
||||
|
||||
// allow getters and setters to be marked as operations directly
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -158,12 +158,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
|
||||
@Override
|
||||
protected boolean includeOperation(Method method, String beanKey) {
|
||||
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
|
||||
if (pd != null) {
|
||||
if (hasManagedAttribute(method)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return hasManagedOperation(method);
|
||||
return (pd != null && hasManagedAttribute(method)) || hasManagedOperation(method);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user