diff --git a/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java b/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java index 1f41aaf60d9..1142cfa943e 100644 --- a/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java +++ b/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java @@ -348,7 +348,7 @@ public class MBeanClientInterceptor /** - * Route the invocation to the configured managed resource.. + * Route the invocation to the configured managed resource. * @param invocation the {@code MethodInvocation} to re-route * @return the value returned as a result of the re-routed invocation * @throws Throwable an invocation error propagated to the user diff --git a/spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java b/spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java index dd9484e9c1a..50aef5f2138 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java @@ -75,7 +75,7 @@ import org.springframework.util.ObjectUtils; * JMX-specific information in the bean classes. * *
If a bean implements one of the JMX management interfaces, MBeanExporter can - * simply register the MBean with the server through its autodetection process. + * simply register the MBean with the server through its auto-detection process. * *
If a bean does not implement one of the JMX management interfaces, MBeanExporter
* will create the management information using the supplied {@link MBeanInfoAssembler}.
@@ -104,21 +104,21 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
BeanClassLoaderAware, BeanFactoryAware, InitializingBean, SmartInitializingSingleton, DisposableBean {
/**
- * Autodetection mode indicating that no autodetection should be used.
+ * Auto-detection mode indicating that no auto-detection should be used.
* @deprecated as of 6.1, in favor of the {@link #setAutodetect "autodetect" flag}
*/
@Deprecated(since = "6.1")
public static final int AUTODETECT_NONE = 0;
/**
- * Autodetection mode indicating that only valid MBeans should be autodetected.
+ * Auto-detection mode indicating that only valid MBeans should be autodetected.
* @deprecated as of 6.1, in favor of the {@link #setAutodetect "autodetect" flag}
*/
@Deprecated(since = "6.1")
public static final int AUTODETECT_MBEAN = 1;
/**
- * Autodetection mode indicating that only the {@link MBeanInfoAssembler} should be able
+ * Auto-detection mode indicating that only the {@link MBeanInfoAssembler} should be able
* to autodetect beans.
* @deprecated as of 6.1, in favor of the {@link #setAutodetect "autodetect" flag}
*/
@@ -126,7 +126,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
public static final int AUTODETECT_ASSEMBLER = 2;
/**
- * Autodetection mode indicating that all autodetection mechanisms should be used.
+ * Auto-detection mode indicating that all auto-detection mechanisms should be used.
* @deprecated as of 6.1, in favor of the {@link #setAutodetect "autodetect" flag}
*/
@Deprecated(since = "6.1")
@@ -162,7 +162,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
@Nullable
Integer autodetectMode;
- /** Whether to eagerly initialize candidate beans when autodetecting MBeans. */
+ /** Whether to eagerly initialize candidate beans when auto-detecting MBeans. */
private boolean allowEagerInit = false;
/** Stores the MBeanInfoAssembler to use for this exporter. */
@@ -177,7 +177,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
/** Indicates whether Spring should expose the managed resource ClassLoader in the MBean. */
private boolean exposeManagedResourceClassLoader = true;
- /** A set of bean names that should be excluded from autodetection. */
+ /** A set of bean names that should be excluded from auto-detection. */
private final Set This feature is turned off by default. Explicitly specify
- * {@code true} here to enable autodetection.
+ * {@code true} here to enable auto-detection.
* @see #setAssembler
* @see AutodetectCapableMBeanInfoAssembler
* @see #isMBean
@@ -236,7 +236,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
}
/**
- * Set the autodetection mode to use by name.
+ * Set the auto-detection mode to use by name.
* @throws IllegalArgumentException if the supplied value is not resolvable
* to one of the {@code AUTODETECT_} constants or is {@code null}
* @see #setAutodetectMode(int)
@@ -255,7 +255,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
}
/**
- * Set the autodetection mode to use.
+ * Set the auto-detection mode to use.
* @throws IllegalArgumentException if the supplied value is not
* one of the {@code AUTODETECT_} constants
* @see #setAutodetectModeName(String)
@@ -274,7 +274,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
/**
* Specify whether to allow eager initialization of candidate beans
- * when autodetecting MBeans in the Spring application context.
+ * when auto-detecting MBeans in the Spring application context.
* Default is "false", respecting lazy-init flags on bean definitions.
* Switch this to "true" in order to search lazy-init beans as well,
* including FactoryBean-produced objects that haven't been initialized yet.
@@ -288,7 +288,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
* for this exporter. Default is a {@code SimpleReflectiveMBeanInfoAssembler}.
* The passed-in assembler can optionally implement the
* {@code AutodetectCapableMBeanInfoAssembler} interface, which enables it
- * to participate in the exporter's MBean autodetection process.
+ * to participate in the exporter's MBean auto-detection process.
* @see org.springframework.jmx.export.assembler.SimpleReflectiveMBeanInfoAssembler
* @see org.springframework.jmx.export.assembler.AutodetectCapableMBeanInfoAssembler
* @see org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler
@@ -334,7 +334,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
}
/**
- * Set the list of names for beans that should be excluded from autodetection.
+ * Set the list of names for beans that should be excluded from auto-detection.
*/
public void setExcludedBeans(String... excludedBeans) {
this.excludedBeans.clear();
@@ -342,7 +342,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
}
/**
- * Add the name of bean that should be excluded from autodetection.
+ * Add the name of bean that should be excluded from auto-detection.
*/
public void addExcludedBean(String excludedBean) {
Assert.notNull(excludedBean, "ExcludedBean must not be null");
@@ -411,7 +411,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
/**
* This callback is only required for resolution of bean names in the
* {@link #setBeans(java.util.Map) "beans"} {@link Map} and for
- * autodetection of MBeans (in the latter case, a
+ * auto-detection of MBeans (in the latter case, a
* {@code ListableBeanFactory} is required).
* @see #setBeans
* @see #setAutodetect
@@ -422,7 +422,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
this.beanFactory = lbf;
}
else {
- logger.debug("MBeanExporter not running in a ListableBeanFactory: autodetection of MBeans not available.");
+ logger.debug("MBeanExporter not running in a ListableBeanFactory: auto-detection of MBeans not available.");
}
}
@@ -537,7 +537,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
* implementation of the {@code ObjectNamingStrategy} interface being used.
*/
protected void registerBeans() {
- // The beans property may be null, for example if we are relying solely on autodetection.
+ // The beans property may be null, for example if we are relying solely on auto-detection.
if (this.beans == null) {
this.beans = new HashMap<>();
// Use AUTODETECT_ALL as default in no beans specified explicitly.
@@ -546,7 +546,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
}
}
- // Perform autodetection, if desired.
+ // Perform auto-detection, if desired.
int mode = (this.autodetectMode != null ? this.autodetectMode : AUTODETECT_NONE);
if (mode != AUTODETECT_NONE) {
if (this.beanFactory == null) {
@@ -554,7 +554,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
}
if (mode == AUTODETECT_MBEAN || mode == AUTODETECT_ALL) {
// Autodetect any beans that are already MBeans.
- logger.debug("Autodetecting user-defined JMX MBeans");
+ logger.debug("Auto-detecting user-defined JMX MBeans");
autodetect(this.beans, (beanClass, beanName) -> isMBean(beanClass));
}
// Allow the assembler a chance to vote for bean inclusion.
@@ -871,11 +871,11 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
//---------------------------------------------------------------------
- // Autodetection process
+ // auto-detection process
//---------------------------------------------------------------------
/**
- * Performs the actual autodetection process, delegating to an
+ * Performs the actual auto-detection process, delegating to an
* {@code AutodetectCallback} instance to vote on the inclusion of a
* given bean.
* @param callback the {@code AutodetectCallback} to use when deciding
@@ -1074,13 +1074,13 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
//---------------------------------------------------------------------
/**
- * Internal callback interface for the autodetection process.
+ * Internal callback interface for the auto-detection process.
*/
@FunctionalInterface
private interface AutodetectCallback {
/**
- * Called during the autodetection process to decide whether
+ * Called during the auto-detection process to decide whether
* a bean should be included.
* @param beanClass the class of the bean
* @param beanName the name of the bean
diff --git a/spring-context/src/main/java/org/springframework/jmx/export/annotation/AnnotationJmxAttributeSource.java b/spring-context/src/main/java/org/springframework/jmx/export/annotation/AnnotationJmxAttributeSource.java
index 975b40be7c5..6f02406bb16 100644
--- a/spring-context/src/main/java/org/springframework/jmx/export/annotation/AnnotationJmxAttributeSource.java
+++ b/spring-context/src/main/java/org/springframework/jmx/export/annotation/AnnotationJmxAttributeSource.java
@@ -117,7 +117,7 @@ public class AnnotationJmxAttributeSource implements JmxAttributeSource, BeanFac
pvs.removePropertyValue("defaultValue");
PropertyAccessorFactory.forBeanPropertyAccess(bean).setPropertyValues(pvs);
String defaultValue = (String) map.get("defaultValue");
- if (defaultValue.length() > 0) {
+ if (!defaultValue.isEmpty()) {
bean.setDefaultValue(defaultValue);
}
return bean;
diff --git a/spring-context/src/main/java/org/springframework/jmx/export/assembler/AutodetectCapableMBeanInfoAssembler.java b/spring-context/src/main/java/org/springframework/jmx/export/assembler/AutodetectCapableMBeanInfoAssembler.java
index a033c01833f..38519552fdb 100644
--- a/spring-context/src/main/java/org/springframework/jmx/export/assembler/AutodetectCapableMBeanInfoAssembler.java
+++ b/spring-context/src/main/java/org/springframework/jmx/export/assembler/AutodetectCapableMBeanInfoAssembler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2023 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.
@@ -17,7 +17,7 @@
package org.springframework.jmx.export.assembler;
/**
- * Extends the {@code MBeanInfoAssembler} to add autodetection logic.
+ * Extends the {@code MBeanInfoAssembler} to add auto-detection logic.
* Implementations of this interface are given the opportunity by the
* {@code MBeanExporter} to include additional beans in the registration process.
*
diff --git a/spring-context/src/main/java/org/springframework/jmx/export/assembler/MetadataMBeanInfoAssembler.java b/spring-context/src/main/java/org/springframework/jmx/export/assembler/MetadataMBeanInfoAssembler.java
index a174e5870bd..86d0cca923e 100644
--- a/spring-context/src/main/java/org/springframework/jmx/export/assembler/MetadataMBeanInfoAssembler.java
+++ b/spring-context/src/main/java/org/springframework/jmx/export/assembler/MetadataMBeanInfoAssembler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2023 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.
@@ -118,7 +118,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
}
/**
- * Used for autodetection of beans. Checks to see if the bean's class has a
+ * Used for auto-detection of beans. Checks to see if the bean's class has a
* {@code ManagedResource} attribute. If so, it will add it to the list of included beans.
* @param beanClass the class of the bean
* @param beanName the name of the bean in the bean factory
@@ -417,7 +417,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* @param setter the int associated with the setter for this attribute
*/
private int resolveIntDescriptor(int getter, int setter) {
- return (getter >= setter ? getter : setter);
+ return Math.max(getter, setter);
}
/**
diff --git a/spring-context/src/main/java/org/springframework/jmx/support/JmxUtils.java b/spring-context/src/main/java/org/springframework/jmx/support/JmxUtils.java
index 23b45e3f7c1..43cb7e719ac 100644
--- a/spring-context/src/main/java/org/springframework/jmx/support/JmxUtils.java
+++ b/spring-context/src/main/java/org/springframework/jmx/support/JmxUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2022 the original author or authors.
+ * Copyright 2002-2023 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.
@@ -169,7 +169,7 @@ public abstract class JmxUtils {
/**
* Create a {@code String[]} representing the argument signature of a
* method. Each element in the array is the fully qualified class name
- * of the corresponding argument in the methods signature.
+ * of the corresponding argument in the method's signature.
* @param method the method to build an argument signature for
* @return the signature as array of argument types
*/