Map<String, ManagedProperty> oldProps = mmo.getProperties();
Map<String, ManagedProperty> newProps = new HashMap<String, ManagedProperty>(oldProps);
if(bmdAliases != null && bmdAliases.size() > 0)
{
ArrayMetaType aliasType = new ArrayMetaType(SimpleMetaType.STRING, false);
DefaultFieldsImpl fields = getFields("alias", aliasType);
fields.setDescription("Aliases of the bean");
String[] aliases = new String[bmdAliases.size()];
Iterator<?> i = bmdAliases.iterator();
for(int n = 0; i.hasNext(); n++)
{
aliases[n] = i.next().toString();
}
ArrayValueSupport value = new ArrayValueSupport(aliasType, aliases);
fields.setValue(value);
ManagedPropertyImpl aliasesMP = new ManagedPropertyImpl(bmdMO, fields);
newProps.put("alias", aliasesMP);
}
// Add a state property
DefaultFieldsImpl stateFields = getFields("state", ControllerStateMetaType.TYPE);
stateFields.setViewUse(new ViewUse[]{ViewUse.STATISTIC});
EnumValue stateValue = getState(bmd.getName(), kernel);
stateFields.setValue(stateValue);
stateFields.setDescription("The bean controller state");
ManagedPropertyImpl stateMP = new ManagedPropertyImpl(mmo, stateFields);
newProps.put("state", stateMP);
// Update the properties
mmo.setProperties(newProps);
}