本文整理汇总了Java中org.springframework.beans.BeanUtils.findPropertyForMethod方法的典型用法代码示例。如果您正苦于以下问题:Java BeanUtils.findPropertyForMethod方法的具体用法?Java BeanUtils.findPropertyForMethod怎么用?Java BeanUtils.findPropertyForMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.BeanUtils
的用法示例。
在下文中一共展示了BeanUtils.findPropertyForMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOperationDescription
import org.springframework.beans.BeanUtils; //导入方法依赖的package包/类
/**
* 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();
}
}
示例2: includeOperation
import org.springframework.beans.BeanUtils; //导入方法依赖的package包/类
/**
* Votes on the inclusion of an operation.
* @param method the operation method
* @param beanKey the key associated with the MBean in the beans map
* @return whether the method has the appropriate metadata
*/
@Override
protected boolean includeOperation(Method method, String beanKey) {
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
if (pd != null) {
if(hasManagedAttribute(method)) {
return true;
}
}
return hasManagedOperation(method);
}