Java Code Examples for org.springframework.jmx.export.metadata.ManagedMetric#getDescription()

The following examples show how to use org.springframework.jmx.export.metadata.ManagedMetric#getDescription() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetadataMBeanInfoAssembler.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * 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();
}
 
Example 2
Source File: MetadataMBeanInfoAssembler.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * 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();
	}
}
 
Example 3
Source File: MetadataMBeanInfoAssembler.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * 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();
}
 
Example 4
Source File: MetadataMBeanInfoAssembler.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * 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();
	}
}
 
Example 5
Source File: MetadataMBeanInfoAssembler.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 ? this.attributeSource.getManagedAttribute(readMethod) : null);
	ManagedAttribute setter =
			(writeMethod != null ? this.attributeSource.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 ? this.attributeSource.getManagedMetric(readMethod) : null);
	if (metric != null && StringUtils.hasText(metric.getDescription())) {
		return metric.getDescription();
	}

	return propertyDescriptor.getDisplayName();
}
 
Example 6
Source File: MetadataMBeanInfoAssembler.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 = this.attributeSource.getManagedAttribute(method);
		if (ma != null && StringUtils.hasText(ma.getDescription())) {
			return ma.getDescription();
		}
		ManagedMetric metric = this.attributeSource.getManagedMetric(method);
		if (metric != null && StringUtils.hasText(metric.getDescription())) {
			return metric.getDescription();
		}
		return method.getName();
	}
	else {
		ManagedOperation mo = this.attributeSource.getManagedOperation(method);
		if (mo != null && StringUtils.hasText(mo.getDescription())) {
			return mo.getDescription();
		}
		return method.getName();
	}
}
 
Example 7
Source File: MetadataMBeanInfoAssembler.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * 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 ? this.attributeSource.getManagedAttribute(readMethod) : null);
	ManagedAttribute setter =
			(writeMethod != null ? this.attributeSource.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 ? this.attributeSource.getManagedMetric(readMethod) : null);
	if (metric != null && StringUtils.hasText(metric.getDescription())) {
		return metric.getDescription();
	}

	return propertyDescriptor.getDisplayName();
}
 
Example 8
Source File: MetadataMBeanInfoAssembler.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * 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 = this.attributeSource.getManagedAttribute(method);
		if (ma != null && StringUtils.hasText(ma.getDescription())) {
			return ma.getDescription();
		}
		ManagedMetric metric = this.attributeSource.getManagedMetric(method);
		if (metric != null && StringUtils.hasText(metric.getDescription())) {
			return metric.getDescription();
		}
		return method.getName();
	}
	else {
		ManagedOperation mo = this.attributeSource.getManagedOperation(method);
		if (mo != null && StringUtils.hasText(mo.getDescription())) {
			return mo.getDescription();
		}
		return method.getName();
	}
}