@Override public ManagedMetric getManagedMetric(Method method) throws InvalidMetadataException { org.springframework.jmx.export.annotation.ManagedMetric ann = AnnotationUtils.findAnnotation( method, org.springframework.jmx.export.annotation.ManagedMetric.class); if (ann == null) { return null; } ManagedMetric managedMetric = new ManagedMetric(); AnnotationBeanUtils.copyPropertiesToBean(ann, managedMetric); return managedMetric; }
@Override public ManagedResource getManagedResource(Class<?> beanClass) throws InvalidMetadataException { org.springframework.jmx.export.annotation.ManagedResource ann = AnnotationUtils.getAnnotation( beanClass, org.springframework.jmx.export.annotation.ManagedResource.class); if (ann == null) { return null; } ManagedResource managedResource = new ManagedResource(); AnnotationBeanUtils.copyPropertiesToBean(ann, managedResource, this.embeddedValueResolver); return managedResource; }
@Override public ManagedOperation getManagedOperation(Method method) throws InvalidMetadataException { Annotation ann = AnnotationUtils.findAnnotation( method, org.springframework.jmx.export.annotation.ManagedOperation.class); if (ann == null) { return null; } ManagedOperation op = new ManagedOperation(); AnnotationBeanUtils.copyPropertiesToBean(ann, op); return op; }
@Override public ManagedAttribute getManagedAttribute(Method method) throws InvalidMetadataException { org.springframework.jmx.export.annotation.ManagedAttribute ann = AnnotationUtils.findAnnotation( method, org.springframework.jmx.export.annotation.ManagedAttribute.class); if (ann == null) { return null; } ManagedAttribute managedAttribute = new ManagedAttribute(); AnnotationBeanUtils.copyPropertiesToBean(ann, managedAttribute, "defaultValue"); if (ann.defaultValue().length() > 0) { managedAttribute.setDefaultValue(ann.defaultValue()); } return managedAttribute; }
@Override public ManagedNotification[] getManagedNotifications(Class<?> clazz) throws InvalidMetadataException { ManagedNotifications notificationsAnn = AnnotationUtils.getAnnotation(clazz, ManagedNotifications.class); if (notificationsAnn == null) { return new ManagedNotification[0]; } Annotation[] notifications = notificationsAnn.value(); ManagedNotification[] result = new ManagedNotification[notifications.length]; for (int i = 0; i < notifications.length; i++) { Annotation notification = notifications[i]; ManagedNotification managedNotification = new ManagedNotification(); AnnotationBeanUtils.copyPropertiesToBean(notification, managedNotification); result[i] = managedNotification; } return result; }
@Override public ManagedOperationParameter[] getManagedOperationParameters(Method method) throws InvalidMetadataException { ManagedOperationParameters params = AnnotationUtils.findAnnotation(method, ManagedOperationParameters.class); ManagedOperationParameter[] result = null; if (params == null) { result = new ManagedOperationParameter[0]; } else { Annotation[] paramData = params.value(); result = new ManagedOperationParameter[paramData.length]; for (int i = 0; i < paramData.length; i++) { Annotation annotation = paramData[i]; ManagedOperationParameter managedOperationParameter = new ManagedOperationParameter(); AnnotationBeanUtils.copyPropertiesToBean(annotation, managedOperationParameter); result[i] = managedOperationParameter; } } return result; }