Search in sources :

Example 1 with ManagedOperationParameter

use of org.springframework.jmx.export.metadata.ManagedOperationParameter in project spring-framework by spring-projects.

the class MetadataMBeanInfoAssembler method getOperationParameters.

/**
	 * Reads {@code MBeanParameterInfo} from the {@code ManagedOperationParameter}
	 * attributes attached to a method. Returns an empty array of {@code MBeanParameterInfo}
	 * if no attributes are found.
	 */
@Override
protected MBeanParameterInfo[] getOperationParameters(Method method, String beanKey) {
    ManagedOperationParameter[] params = this.attributeSource.getManagedOperationParameters(method);
    if (ObjectUtils.isEmpty(params)) {
        return super.getOperationParameters(method, beanKey);
    }
    MBeanParameterInfo[] parameterInfo = new MBeanParameterInfo[params.length];
    Class<?>[] methodParameters = method.getParameterTypes();
    for (int i = 0; i < params.length; i++) {
        ManagedOperationParameter param = params[i];
        parameterInfo[i] = new MBeanParameterInfo(param.getName(), methodParameters[i].getName(), param.getDescription());
    }
    return parameterInfo;
}
Also used : ManagedOperationParameter(org.springframework.jmx.export.metadata.ManagedOperationParameter) MBeanParameterInfo(javax.management.MBeanParameterInfo)

Aggregations

MBeanParameterInfo (javax.management.MBeanParameterInfo)1 ManagedOperationParameter (org.springframework.jmx.export.metadata.ManagedOperationParameter)1