}
// Para cada operação descoberta no ManagementController, cria um operationInfo correspondente
for (Entry<String, MethodDetail> methodEntry : managedType.getOperationMethods().entrySet()) {
MethodDetail methodDetail = methodEntry.getValue();
ParameterDetail[] parameterTypes = methodDetail.getParameterTypers();
MBeanParameterInfo[] parameters = parameterTypes.length > 0 ? new MBeanParameterInfo[parameterTypes.length]
: null;
if (parameters != null) {
for (int i = 0; i < parameterTypes.length; i++) {
parameters[i] = new MBeanParameterInfo(parameterTypes[i].getParameterName(), parameterTypes[i]
.getParameterType().getCanonicalName(), parameterTypes[i].getParameterDescription());
}
}
// Com todas as informações, criamos nossa instância de MBeanOperationInfo e
// acrescentamos na lista de todas as operações.
int operationType = 0;
switch(methodDetail.getType()){
case ACTION:
operationType = MBeanOperationInfo.ACTION;
break;
case INFO:
operationType = MBeanOperationInfo.INFO;
break;
case ACTION_INFO:
operationType = MBeanOperationInfo.ACTION_INFO;
break;
default:
operationType = MBeanOperationInfo.UNKNOWN;
}
MBeanOperationInfo operation = new MBeanOperationInfo(methodDetail.getMethod().getName(),
methodDetail.getDescription(), parameters, methodDetail.getMethod().getReturnType().getName(),
operationType);
operations.add(operation);
}