//
ArrayList<ModelMBeanOperationInfo> operations = new ArrayList<ModelMBeanOperationInfo>();
for (ManagedMethodMetaData methodMD : typeMD.getMethods())
{
ModelMBeanOperationInfo operationInfo =
buildOperationInfo(methodMD.getMethod(), methodMD.getDescription(), Role.OP,
methodMD.getParameters(), methodMD.getImpact());
operations.add(operationInfo);
}
//
Map<String, ModelMBeanAttributeInfo> attributeInfos = new HashMap<String, ModelMBeanAttributeInfo>();
for (ManagedPropertyMetaData propertyMD : typeMD.getProperties())
{
Method getter = propertyMD.getGetter();
if (getter != null)
{
Role role;
String getterName = getter.getName();
if (getterName.startsWith("get") && getterName.length() > 3)
{
role = Role.GET;
}
else if (getterName.startsWith("is") && getterName.length() > 2)
{
role = Role.IS;
}
else
{
throw new AssertionError();
}
Collection<ManagedMethodParameterMetaData> blah = Collections.emptyList();
ModelMBeanOperationInfo operationInfo =
buildOperationInfo(getter, propertyMD.getGetterDescription(), role, blah, ImpactType.READ);
operations.add(operationInfo);
}
//
Method setter = propertyMD.getSetter();
if (setter != null)
{
ManagedMethodParameterMetaData s = new ManagedMethodParameterMetaData(0);
s.setDescription(propertyMD.getSetterParameter().getDescription());
s.setName(propertyMD.getSetterParameter().getName());
Collection<ManagedMethodParameterMetaData> blah = Collections.singletonList(s);
ModelMBeanOperationInfo operationInfo =
buildOperationInfo(setter, propertyMD.getSetterDescription(), Role.SET, blah, ImpactType.IDEMPOTENT_WRITE);
operations.add(operationInfo);
}
//