use of org.glassfish.admin.amx.annotation.Description in project Payara by payara.
the class MBeanInfoSupport method parameterInfos.
public static MBeanParameterInfo[] parameterInfos(final Method method) {
final Class<?>[] sig = method.getParameterTypes();
final Annotation[][] paramAnnotations = method.getParameterAnnotations();
final MBeanParameterInfo[] infos = new MBeanParameterInfo[sig.length];
for (int i = 0; i < sig.length; ++i) {
final Class<?> paramClass = translatedType(sig[i]);
final Annotation[] annotations = paramAnnotations[i];
final Param p = getAnnotation(annotations, Param.class);
final String paramName = (p == null || p.name().length() == 0) ? ("p" + i) : p.name();
final Description d = getAnnotation(annotations, Description.class);
String description = "";
if (d != null && d.value().length() != 0) {
description = d.value();
}
final String type = paramClass.getName();
final MBeanParameterInfo info = new MBeanParameterInfo(paramName, type, description);
infos[i] = info;
}
return (infos);
}
use of org.glassfish.admin.amx.annotation.Description in project Payara by payara.
the class MBeanInfoSupport method attributeInfo.
/**
* Return MBeanAttributeInfo for the method. If it's a getter,
* it's marked as read-only, if it's a setter, it's marked as read/write.
* @param m
* @return
*/
public static MBeanAttributeInfo attributeInfo(final Method m) {
final ManagedAttribute managed = m.getAnnotation(ManagedAttribute.class);
if (managed == null) {
return null;
}
final Description d = m.getAnnotation(Description.class);
final String description = d == null ? "" : d.value();
String attrName = JMXUtil.getAttributeName(m);
final boolean isGetter = JMXUtil.isGetter(m);
final boolean isSetter = JMXUtil.isSetter(m);
final boolean isIs = JMXUtil.isIs(m);
final MBeanAttributeInfo info = new MBeanAttributeInfo(attrName, m.getReturnType().getName(), description, isGetter, isSetter, isIs, null);
return info;
}
Aggregations