Browse Source

Reorganize methods in MBeanExporter

pull/30915/head
Sam Brannen 3 years ago
parent
commit
676daa990b
  1. 32
      spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java

32
spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java

@ -224,39 +224,39 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo @@ -224,39 +224,39 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
}
/**
* Set the autodetection mode to use.
* @throws IllegalArgumentException if the supplied value is not
* one of the {@code AUTODETECT_} constants
* @see #setAutodetectModeName(String)
* Set the autodetection 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)
* @see #getAutodetectMode()
* @see #AUTODETECT_ALL
* @see #AUTODETECT_ASSEMBLER
* @see #AUTODETECT_MBEAN
* @see #AUTODETECT_NONE
*/
public void setAutodetectMode(int autodetectMode) {
if (!constants.getValues(CONSTANT_PREFIX_AUTODETECT).contains(autodetectMode)) {
throw new IllegalArgumentException("Only values of autodetect constants allowed");
public void setAutodetectModeName(String constantName) {
if (!constantName.startsWith(CONSTANT_PREFIX_AUTODETECT)) {
throw new IllegalArgumentException("Only autodetect constants allowed");
}
this.autodetectMode = autodetectMode;
this.autodetectMode = (Integer) constants.asNumber(constantName);
}
/**
* Set the autodetection 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)
* Set the autodetection mode to use.
* @throws IllegalArgumentException if the supplied value is not
* one of the {@code AUTODETECT_} constants
* @see #setAutodetectModeName(String)
* @see #getAutodetectMode()
* @see #AUTODETECT_ALL
* @see #AUTODETECT_ASSEMBLER
* @see #AUTODETECT_MBEAN
* @see #AUTODETECT_NONE
*/
public void setAutodetectModeName(String constantName) {
if (!constantName.startsWith(CONSTANT_PREFIX_AUTODETECT)) {
throw new IllegalArgumentException("Only autodetect constants allowed");
public void setAutodetectMode(int autodetectMode) {
if (!constants.getValues(CONSTANT_PREFIX_AUTODETECT).contains(autodetectMode)) {
throw new IllegalArgumentException("Only values of autodetect constants allowed");
}
this.autodetectMode = (Integer) constants.asNumber(constantName);
this.autodetectMode = autodetectMode;
}
/**

Loading…
Cancel
Save