private static void populateMetricsAndOperations(List<Class<?>> classes, Props props, boolean withNamePrefix) {
props.setHasOperations(true);
props.setHasMetrics(true);
for (Class<?> clazz : classes) {
MBean mbean = clazz.getAnnotation(MBean.class);
String prefix = withNamePrefix ? mbean.objectName() + '.' : "";
Method[] methods = clazz.getMethods();
for (Method method : methods) {
Metric rhqMetric = method.getAnnotation(Metric.class);
ManagedAttribute managedAttr = method.getAnnotation(ManagedAttribute.class);
ManagedOperation managedOp = method.getAnnotation(ManagedOperation.class);