Search in sources :

Example 1 with Param

use of org.glassfish.admin.amx.annotation.Param 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);
}
Also used : Description(org.glassfish.admin.amx.annotation.Description) Param(org.glassfish.admin.amx.annotation.Param) Annotation(java.lang.annotation.Annotation) MBeanParameterInfo(javax.management.MBeanParameterInfo)

Aggregations

Annotation (java.lang.annotation.Annotation)1 MBeanParameterInfo (javax.management.MBeanParameterInfo)1 Description (org.glassfish.admin.amx.annotation.Description)1 Param (org.glassfish.admin.amx.annotation.Param)1