/** * Checks to see if the given Method has the {@code ManagedOperation} attribute. * @param method the method to check */ private boolean hasManagedOperation(Method method) { return (obtainAttributeSource().getManagedOperation(method) != null); }
/** * Checks to see if the given Method has the {@code ManagedOperation} attribute. * @param method the method to check */ private boolean hasManagedOperation(Method method) { return (obtainAttributeSource().getManagedOperation(method) != null); }
/** * Adds descriptor fields from the {@code ManagedAttribute} attribute * to the attribute descriptor. Specifically, adds the {@code currencyTimeLimit} * descriptor field if it is present in the metadata. */ @Override protected void populateOperationDescriptor(Descriptor desc, Method method, String beanKey) { ManagedOperation mo = obtainAttributeSource().getManagedOperation(method); if (mo != null) { applyCurrencyTimeLimit(desc, mo.getCurrencyTimeLimit()); } }
/** * Adds descriptor fields from the {@code ManagedAttribute} attribute * to the attribute descriptor. Specifically, adds the {@code currencyTimeLimit} * descriptor field if it is present in the metadata. */ @Override protected void populateOperationDescriptor(Descriptor desc, Method method, String beanKey) { ManagedOperation mo = obtainAttributeSource().getManagedOperation(method); if (mo != null) { applyCurrencyTimeLimit(desc, mo.getCurrencyTimeLimit()); } }
/** * 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(); } }
/** * 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 String getDescription(Method method, Supplier<String> fallback) { ManagedOperation managed = jmxAttributeSource.getManagedOperation(method); if (managed != null && StringUtils.hasText(managed.getDescription())) { return managed.getDescription(); } return fallback.get(); }
/** * Checks to see if the given Method has the {@code ManagedOperation} attribute. * @param method the method to check */ private boolean hasManagedOperation(Method method) { return (obtainAttributeSource().getManagedOperation(method) != null); }
/** * Votes on the inclusion of an attribute mutator. * * @param method the mutator method * @param beanKey the key associated with the MBean in the beans map * @return whether the method has the appropriate metadata */ @Override protected boolean includeWriteAttribute(@Nonnull Method method, @Nonnull String beanKey) { Method interfaceMethod = findJmxMethod(method, beanKey); boolean operation = interfaceMethod != null && attributeSource.getManagedOperation(interfaceMethod) != null; // @Operation annotation means it's really an operation, not attribute setter boolean result = interfaceMethod != null && !operation; return result; }
/** * 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; }
/** * Adds descriptor fields from the {@code ManagedAttribute} attribute * to the attribute descriptor. Specifically, adds the {@code currencyTimeLimit} * descriptor field if it is present in the metadata. */ @Override protected void populateOperationDescriptor(Descriptor desc, Method method, String beanKey) { ManagedOperation mo = obtainAttributeSource().getManagedOperation(method); if (mo != null) { applyCurrencyTimeLimit(desc, mo.getCurrencyTimeLimit()); } }
/** * Adds descriptor fields from the {@code ManagedAttribute} attribute to the attribute descriptor. Specifically, * adds the {@code currencyTimeLimit} descriptor field if it is present in the metadata. */ @Override protected void populateOperationDescriptor(@Nonnull Descriptor desc, Method method, String beanKey) { Method resolvedOperation = findJmxMethod(method, beanKey); ManagedOperation mo = this.attributeSource.getManagedOperation(resolvedOperation); applyRunAsync(desc, resolvedOperation); if (mo != null) { applyCurrencyTimeLimit(desc, mo.getCurrencyTimeLimit()); } }
/** * 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 }
/** * 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(); } }