String methodName=method.getName();
if(!methodName.startsWith("get") && !methodName.startsWith("set") && !methodName.startsWith("is")) {
log.warn("method name " + methodName + " doesn't start with \"get\", \"set\", or \"is\"" + ", but is annotated with @ManagedAttribute: will be ignored");
return;
}
ManagedAttribute attr = method.getAnnotation(ManagedAttribute.class);
Property prop=method.getAnnotation(Property.class);
boolean expose_prop=prop != null && prop.exposeAsManagedAttribute();
boolean expose=attr != null || expose_prop;
if(!expose){
return;
}
// Is name field of @ManagedAttributed used?
String attributeName=attr != null? attr.name() : null;
if(attributeName != null && attributeName.trim().length() > 0){
attributeName=attributeName.trim();
} else {
attributeName=null;
}
String descr=attr != null ? attr.description() : prop != null? prop.description() : null;
boolean writeAttribute=false;
MBeanAttributeInfo info=null;
if(isSetMethod(method)) { // setter
attributeName=(attributeName==null)?methodName.substring(3):attributeName;