/** * Checks to see if the given Method has the {@code ManagedMetric} attribute. */ private boolean hasManagedMetric(Method method) { return (obtainAttributeSource().getManagedMetric(method) != null); }
/** * Checks to see if the given Method has the {@code ManagedMetric} attribute. */ private boolean hasManagedMetric(Method method) { return (obtainAttributeSource().getManagedMetric(method) != null); }
/** * Adds descriptor fields from the {@code ManagedAttribute} attribute or the {@code ManagedMetric} attribute * to the attribute descriptor. */ @Override protected void populateAttributeDescriptor( Descriptor desc, @Nullable Method getter, @Nullable Method setter, String beanKey) { if (getter != null) { ManagedMetric metric = obtainAttributeSource().getManagedMetric(getter); if (metric != null) { populateMetricDescriptor(desc, metric); return; } } ManagedAttribute gma = (getter != null ? obtainAttributeSource().getManagedAttribute(getter) : null); ManagedAttribute sma = (setter != null ? obtainAttributeSource().getManagedAttribute(setter) : null); populateAttributeDescriptor(desc, (gma != null ? gma : ManagedAttribute.EMPTY), (sma != null ? sma : ManagedAttribute.EMPTY)); }
/** * 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(); } }
/** * Adds descriptor fields from the {@code ManagedAttribute} attribute or the {@code ManagedMetric} attribute * to the attribute descriptor. */ @Override protected void populateAttributeDescriptor( Descriptor desc, @Nullable Method getter, @Nullable Method setter, String beanKey) { if (getter != null) { ManagedMetric metric = obtainAttributeSource().getManagedMetric(getter); if (metric != null) { populateMetricDescriptor(desc, metric); return; } } ManagedAttribute gma = (getter != null ? obtainAttributeSource().getManagedAttribute(getter) : null); ManagedAttribute sma = (setter != null ? obtainAttributeSource().getManagedAttribute(setter) : null); populateAttributeDescriptor(desc, (gma != null ? gma : ManagedAttribute.EMPTY), (sma != null ? sma : ManagedAttribute.EMPTY)); }
/** * 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(); } }
/** * 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(); }
/** * Checks to see if the given Method has the {@code ManagedMetric} attribute. */ private boolean hasManagedMetric(Method method) { return (obtainAttributeSource().getManagedMetric(method) != null); }
/** * Vote on the inclusion of an attribute accessor. * * @param method the accessor method * @param beanKey the key associated with the MBean in the beans map * @return whether the method has the appropriate metadata */ @Override protected boolean includeReadAttribute(@Nonnull Method method, @Nonnull String beanKey) { Method interfaceMethod = findJmxMethod(method, beanKey); boolean metric = interfaceMethod != null && attributeSource.getManagedMetric(interfaceMethod) != null; boolean operation = interfaceMethod != null && attributeSource.getManagedOperation(interfaceMethod) != null; // either metric or just interface method without @Operation annotation boolean result = interfaceMethod != null && (metric || !operation); return result; }
/** * 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 ""; }
/** * Adds descriptor fields from the {@code ManagedAttribute} attribute or the {@code ManagedMetric} attribute * to the attribute descriptor. */ @Override protected void populateAttributeDescriptor( Descriptor desc, @Nullable Method getter, @Nullable Method setter, String beanKey) { if (getter != null) { ManagedMetric metric = obtainAttributeSource().getManagedMetric(getter); if (metric != null) { populateMetricDescriptor(desc, metric); return; } } ManagedAttribute gma = (getter != null ? obtainAttributeSource().getManagedAttribute(getter) : null); ManagedAttribute sma = (setter != null ? obtainAttributeSource().getManagedAttribute(setter) : null); populateAttributeDescriptor(desc, (gma != null ? gma : ManagedAttribute.EMPTY), (sma != null ? sma : ManagedAttribute.EMPTY)); }
/** * 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(); } }
/** * Adds descriptor fields from the {@code ManagedAttribute} attribute or the {@code ManagedMetric} attribute * to the attribute descriptor. */ @Override protected void populateAttributeDescriptor(@Nonnull Descriptor desc, Method getter, Method setter, String beanKey) { Method resolvedGetter = findJmxMethod(getter, beanKey); Method resolvedSetter = findJmxMethod(setter, beanKey); ManagedMetric metricInfo = resolvedGetter != null ? attributeSource.getManagedMetric(resolvedGetter) : null; if (getter != null && metricInfo != null) { populateMetricDescriptor(desc, metricInfo); } else { ManagedAttribute gma = (resolvedGetter == null) ? null : this.attributeSource.getManagedAttribute(resolvedGetter); ManagedAttribute sma = (resolvedSetter == null) ? null : this.attributeSource.getManagedAttribute(resolvedSetter); if (gma == null) { gma = ManagedAttribute.EMPTY; } if (sma == null) { sma = ManagedAttribute.EMPTY; } populateAttributeDescriptor(desc, gma, sma); } }