private void populateMetricDescriptor(Descriptor desc, ManagedMetric metric) { applyCurrencyTimeLimit(desc, metric.getCurrencyTimeLimit()); if (StringUtils.hasLength(metric.getPersistPolicy())) { desc.setField(FIELD_PERSIST_POLICY, metric.getPersistPolicy()); } if (metric.getPersistPeriod() >= 0) { desc.setField(FIELD_PERSIST_PERIOD, Integer.toString(metric.getPersistPeriod())); } if (StringUtils.hasLength(metric.getDisplayName())) { desc.setField(FIELD_DISPLAY_NAME, metric.getDisplayName()); } if (StringUtils.hasLength(metric.getUnit())) { desc.setField(FIELD_UNITS, metric.getUnit()); } if (StringUtils.hasLength(metric.getCategory())) { desc.setField(FIELD_METRIC_CATEGORY, metric.getCategory()); } desc.setField(FIELD_METRIC_TYPE, metric.getMetricType().toString()); }
/** * Creates a description for the attribute corresponding to this property * descriptor. Attempts to create the description using metadata from either * the getter or setter attributes, otherwise uses the property name. */ @Override protected String getAttributeDescription(PropertyDescriptor propertyDescriptor, String beanKey) { Method readMethod = propertyDescriptor.getReadMethod(); Method writeMethod = propertyDescriptor.getWriteMethod(); ManagedAttribute getter = (readMethod != null ? obtainAttributeSource().getManagedAttribute(readMethod) : null); ManagedAttribute setter = (writeMethod != null ? obtainAttributeSource().getManagedAttribute(writeMethod) : null); if (getter != null && StringUtils.hasText(getter.getDescription())) { return getter.getDescription(); } else if (setter != null && StringUtils.hasText(setter.getDescription())) { return setter.getDescription(); } ManagedMetric metric = (readMethod != null ? obtainAttributeSource().getManagedMetric(readMethod) : null); if (metric != null && StringUtils.hasText(metric.getDescription())) { return metric.getDescription(); } return propertyDescriptor.getDisplayName(); }
private void populateMetricDescriptor(Descriptor desc, ManagedMetric metric) { applyCurrencyTimeLimit(desc, metric.getCurrencyTimeLimit()); if (StringUtils.hasLength(metric.getPersistPolicy())) { desc.setField(FIELD_PERSIST_POLICY, metric.getPersistPolicy()); } if (metric.getPersistPeriod() >= 0) { desc.setField(FIELD_PERSIST_PERIOD, Integer.toString(metric.getPersistPeriod())); } if (StringUtils.hasLength(metric.getDisplayName())) { desc.setField(FIELD_DISPLAY_NAME, metric.getDisplayName()); } if (StringUtils.hasLength(metric.getUnit())) { desc.setField(FIELD_UNITS, metric.getUnit()); } if (StringUtils.hasLength(metric.getCategory())) { desc.setField(FIELD_METRIC_CATEGORY, metric.getCategory()); } desc.setField(FIELD_METRIC_TYPE, metric.getMetricType().toString()); }
/** * Retrieves the description for the supplied {@code Method} from the * metadata. Uses the method name is no description is present in the metadata. */ @Override protected String getOperationDescription(Method method, String beanKey) { PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method); if (pd != null) { ManagedAttribute ma = obtainAttributeSource().getManagedAttribute(method); if (ma != null && StringUtils.hasText(ma.getDescription())) { return ma.getDescription(); } ManagedMetric metric = obtainAttributeSource().getManagedMetric(method); if (metric != null && StringUtils.hasText(metric.getDescription())) { return metric.getDescription(); } return method.getName(); } else { ManagedOperation mo = obtainAttributeSource().getManagedOperation(method); if (mo != null && StringUtils.hasText(mo.getDescription())) { return mo.getDescription(); } return method.getName(); } }
private void populateMetricDescriptor(Descriptor desc, ManagedMetric metric) { applyCurrencyTimeLimit(desc, metric.getCurrencyTimeLimit()); if (StringUtils.hasLength(metric.getPersistPolicy())) { desc.setField(FIELD_PERSIST_POLICY, metric.getPersistPolicy()); } if (metric.getPersistPeriod() >= 0) { desc.setField(FIELD_PERSIST_PERIOD, Integer.toString(metric.getPersistPeriod())); } if (StringUtils.hasLength(metric.getDisplayName())) { desc.setField(FIELD_DISPLAY_NAME, metric.getDisplayName()); } if (StringUtils.hasLength(metric.getUnit())) { desc.setField(FIELD_UNITS, metric.getUnit()); } if (StringUtils.hasLength(metric.getCategory())) { desc.setField(FIELD_METRIC_CATEGORY, metric.getCategory()); } desc.setField(FIELD_METRIC_TYPE, metric.getMetricType().toString()); }
/** * Retrieves the description for the supplied {@code Method} from the * metadata. Uses the method name is no description is present in the metadata. */ @Override protected String getOperationDescription(Method method, String beanKey) { PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method); if (pd != null) { ManagedAttribute ma = obtainAttributeSource().getManagedAttribute(method); if (ma != null && StringUtils.hasText(ma.getDescription())) { return ma.getDescription(); } ManagedMetric metric = obtainAttributeSource().getManagedMetric(method); if (metric != null && StringUtils.hasText(metric.getDescription())) { return metric.getDescription(); } return method.getName(); } else { ManagedOperation mo = obtainAttributeSource().getManagedOperation(method); if (mo != null && StringUtils.hasText(mo.getDescription())) { return mo.getDescription(); } return method.getName(); } }
private void populateMetricDescriptor(Descriptor desc, ManagedMetric metric) { applyCurrencyTimeLimit(desc, metric.getCurrencyTimeLimit()); if (StringUtils.hasLength(metric.getPersistPolicy())) { desc.setField(FIELD_PERSIST_POLICY, metric.getPersistPolicy()); } if (metric.getPersistPeriod() >= 0) { desc.setField(FIELD_PERSIST_PERIOD, Integer.toString(metric.getPersistPeriod())); } if (StringUtils.hasLength(metric.getDisplayName())) { desc.setField(FIELD_DISPLAY_NAME, metric.getDisplayName()); } if (StringUtils.hasLength(metric.getUnit())) { desc.setField(FIELD_UNITS, metric.getUnit()); } if (StringUtils.hasLength(metric.getCategory())) { desc.setField(FIELD_METRIC_CATEGORY, metric.getCategory()); } desc.setField(FIELD_METRIC_TYPE, metric.getMetricType().toString()); }
/** * Creates a description for the attribute corresponding to this property * descriptor. Attempts to create the description using metadata from either * the getter or setter attributes, otherwise uses the property name. */ @Override protected String getAttributeDescription(PropertyDescriptor propertyDescriptor, String beanKey) { Method readMethod = propertyDescriptor.getReadMethod(); Method writeMethod = propertyDescriptor.getWriteMethod(); ManagedAttribute getter = (readMethod != null ? obtainAttributeSource().getManagedAttribute(readMethod) : null); ManagedAttribute setter = (writeMethod != null ? obtainAttributeSource().getManagedAttribute(writeMethod) : null); if (getter != null && StringUtils.hasText(getter.getDescription())) { return getter.getDescription(); } else if (setter != null && StringUtils.hasText(setter.getDescription())) { return setter.getDescription(); } ManagedMetric metric = (readMethod != null ? obtainAttributeSource().getManagedMetric(readMethod) : null); if (metric != null && StringUtils.hasText(metric.getDescription())) { return metric.getDescription(); } return propertyDescriptor.getDisplayName(); }
/** * Creates a description for the attribute corresponding to this property * descriptor. Attempts to create the description using metadata from either * the getter or setter attributes, otherwise uses the property name. */ @Nonnull @Override protected String getAttributeDescription(PropertyDescriptor propertyDescriptor, String beanKey) { Method readMethod = propertyDescriptor.getReadMethod(); Method writeMethod = propertyDescriptor.getWriteMethod(); Method resolvedGetter = findJmxMethod(readMethod, beanKey); Method resolvedSetter = findJmxMethod(writeMethod, beanKey); ManagedAttribute getter = (resolvedGetter != null ? this.attributeSource.getManagedAttribute(resolvedGetter) : null); ManagedAttribute setter = (resolvedSetter != null ? this.attributeSource.getManagedAttribute(resolvedSetter) : null); if (getter != null && StringUtils.hasText(getter.getDescription())) { return getter.getDescription(); } else if (setter != null && StringUtils.hasText(setter.getDescription())) { return setter.getDescription(); } ManagedMetric metric = (resolvedGetter != null ? this.attributeSource.getManagedMetric(resolvedGetter) : null); if (metric != null && StringUtils.hasText(metric.getDescription())) { return metric.getDescription(); } return ""; }
/** * Retrieves the description for the supplied {@code Method} from the * metadata. Uses the method name is no description is present in the metadata. */ @Override @Nonnull protected String getOperationDescription(Method method, String beanKey) { PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method); Method resolvedMethod = findJmxMethod(method, beanKey); if (pd != null) { ManagedAttribute ma = this.attributeSource.getManagedAttribute(resolvedMethod); if (ma != null && StringUtils.hasText(ma.getDescription())) { return ma.getDescription(); } ManagedMetric metric = this.attributeSource.getManagedMetric(resolvedMethod); if (metric != null && StringUtils.hasText(metric.getDescription())) { return metric.getDescription(); } } ManagedOperation mo = this.attributeSource.getManagedOperation(resolvedMethod); if (mo != null && StringUtils.hasText(mo.getDescription())) { return mo.getDescription(); } return ""; // no operation description by default }
/** * Creates a description for the attribute corresponding to this property * descriptor. Attempts to create the description using metadata from either * the getter or setter attributes, otherwise uses the property name. */ @Override protected String getAttributeDescription(PropertyDescriptor propertyDescriptor, String beanKey) { Method readMethod = propertyDescriptor.getReadMethod(); Method writeMethod = propertyDescriptor.getWriteMethod(); ManagedAttribute getter = (readMethod != null ? obtainAttributeSource().getManagedAttribute(readMethod) : null); ManagedAttribute setter = (writeMethod != null ? obtainAttributeSource().getManagedAttribute(writeMethod) : null); if (getter != null && StringUtils.hasText(getter.getDescription())) { return getter.getDescription(); } else if (setter != null && StringUtils.hasText(setter.getDescription())) { return setter.getDescription(); } ManagedMetric metric = (readMethod != null ? obtainAttributeSource().getManagedMetric(readMethod) : null); if (metric != null && StringUtils.hasText(metric.getDescription())) { return metric.getDescription(); } return propertyDescriptor.getDisplayName(); }
/** * Retrieves the description for the supplied {@code Method} from the * metadata. Uses the method name is no description is present in the metadata. */ @Override protected String getOperationDescription(Method method, String beanKey) { PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method); if (pd != null) { ManagedAttribute ma = obtainAttributeSource().getManagedAttribute(method); if (ma != null && StringUtils.hasText(ma.getDescription())) { return ma.getDescription(); } ManagedMetric metric = obtainAttributeSource().getManagedMetric(method); if (metric != null && StringUtils.hasText(metric.getDescription())) { return metric.getDescription(); } return method.getName(); } else { ManagedOperation mo = obtainAttributeSource().getManagedOperation(method); if (mo != null && StringUtils.hasText(mo.getDescription())) { return mo.getDescription(); } return method.getName(); } }