Polish
This commit is contained in:
@@ -32,11 +32,24 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@ManagedResource
|
||||
public class DataEndpointMBean extends EndpointMBean {
|
||||
|
||||
/**
|
||||
* Create a new {@link DataEndpointMBean} instance.
|
||||
* @param beanName the bean name
|
||||
* @param endpoint the endpoint to wrap
|
||||
* @deprecated since 1.3 in favor of
|
||||
* {@link #DataEndpointMBean(String, Endpoint, ObjectMapper)}
|
||||
*/
|
||||
@Deprecated
|
||||
public DataEndpointMBean(String beanName, Endpoint<?> endpoint) {
|
||||
super(beanName, endpoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link DataEndpointMBean} instance.
|
||||
* @param beanName the bean name
|
||||
* @param endpoint the endpoint to wrap
|
||||
* @param objectMapper the {@link ObjectMapper} used to convert the payload
|
||||
*/
|
||||
public DataEndpointMBean(String beanName, Endpoint<?> endpoint,
|
||||
ObjectMapper objectMapper) {
|
||||
super(beanName, endpoint, objectMapper);
|
||||
|
||||
@@ -40,11 +40,24 @@ public class EndpointMBean {
|
||||
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
/**
|
||||
* Create a new {@link EndpointMBean} instance.
|
||||
* @param beanName the bean name
|
||||
* @param endpoint the endpoint to wrap
|
||||
* @deprecated since 1.3 in favor of
|
||||
* {@link #EndpointMBean(String, Endpoint, ObjectMapper)}
|
||||
*/
|
||||
@Deprecated
|
||||
public EndpointMBean(String beanName, Endpoint<?> endpoint) {
|
||||
this(beanName, endpoint, new ObjectMapper());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link EndpointMBean} instance.
|
||||
* @param beanName the bean name
|
||||
* @param endpoint the endpoint to wrap
|
||||
* @param objectMapper the {@link ObjectMapper} used to convert the payload
|
||||
*/
|
||||
public EndpointMBean(String beanName, Endpoint<?> endpoint, ObjectMapper objectMapper) {
|
||||
Assert.notNull(beanName, "BeanName must not be null");
|
||||
Assert.notNull(endpoint, "Endpoint must not be null");
|
||||
@@ -71,15 +84,12 @@ public class EndpointMBean {
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (result instanceof String) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (result.getClass().isArray() || result instanceof List) {
|
||||
return this.mapper.convertValue(result, List.class);
|
||||
}
|
||||
|
||||
return this.mapper.convertValue(result, Map.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,12 +96,19 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
/**
|
||||
* Create a new {@link EndpointMBeanExporter} instance.
|
||||
*/
|
||||
public EndpointMBeanExporter() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link EndpointMBeanExporter} instance.
|
||||
* @param objectMapper the object mapper
|
||||
*/
|
||||
public EndpointMBeanExporter(ObjectMapper objectMapper) {
|
||||
this.objectMapper = objectMapper == null ? new ObjectMapper() : objectMapper;
|
||||
this.objectMapper = (objectMapper == null ? new ObjectMapper() : objectMapper);
|
||||
setAutodetect(false);
|
||||
setNamingStrategy(this.defaultNamingStrategy);
|
||||
setAssembler(this.assembler);
|
||||
|
||||
@@ -32,14 +32,27 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@ManagedResource
|
||||
public class ShutdownEndpointMBean extends EndpointMBean {
|
||||
|
||||
/**
|
||||
* Create a new {@link ShutdownEndpointMBean} instance.
|
||||
* @param beanName the bean name
|
||||
* @param endpoint the endpoint to wrap
|
||||
* @deprecated since 1.3 in favor of
|
||||
* {@link #ShutdownEndpointMBean(String, Endpoint, ObjectMapper)}
|
||||
*/
|
||||
@Deprecated
|
||||
public ShutdownEndpointMBean(String beanName, Endpoint<?> endpoint) {
|
||||
super(beanName, endpoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link ShutdownEndpointMBean} instance.
|
||||
* @param beanName the bean name
|
||||
* @param endpoint the endpoint to wrap
|
||||
* @param objectMapper the {@link ObjectMapper} used to convert the payload
|
||||
*/
|
||||
public ShutdownEndpointMBean(String beanName, Endpoint<?> endpoint,
|
||||
ObjectMapper mapper) {
|
||||
super(beanName, endpoint, mapper);
|
||||
ObjectMapper objectMapper) {
|
||||
super(beanName, endpoint, objectMapper);
|
||||
}
|
||||
|
||||
@ManagedOperation(description = "Shutdown the ApplicationContext")
|
||||
|
||||
Reference in New Issue
Block a user