use of javax.management.MBeanParameterInfo in project Payara by payara.
the class ConfigBeanJMXSupport method duckTypedToMBeanOperationInfo.
/**
* DuckTyped methods are <em>always</em> exposed as operations, never as Attributes.
*/
public MBeanOperationInfo duckTypedToMBeanOperationInfo(final DuckTypedInfo info) {
final Descriptor descriptor = descriptor(info.duckTyped());
final String name = info.name();
final Class<?> type = remoteType(info.returnType());
final String description = "@DuckTyped " + name + " of " + mIntf.getName();
// how to tell?
final int impact = MBeanOperationInfo.UNKNOWN;
final List<MBeanParameterInfo> paramInfos = new ArrayList<MBeanParameterInfo>();
int i = 0;
for (final Class<?> paramClass : info.signature()) {
final String paramName = "p" + i;
final String paramType = remoteType(paramClass).getName();
final String paramDescription = "parameter " + i;
final MBeanParameterInfo paramInfo = new MBeanParameterInfo(paramName, paramType, paramDescription, null);
paramInfos.add(paramInfo);
++i;
}
final MBeanParameterInfo[] paramInfosArray = CollectionUtil.toArray(paramInfos, MBeanParameterInfo.class);
final MBeanOperationInfo opInfo = new MBeanOperationInfo(name, description, paramInfosArray, type.getName(), impact, descriptor);
return opInfo;
}
use of javax.management.MBeanParameterInfo in project Payara by payara.
the class MBeanInterfaceGenerator method generateOperations.
protected String generateOperations(MBeanOperationInfo[] infos) {
final StringBuffer buf = new StringBuffer();
for (int i = 0; i < infos.length; ++i) {
final MBeanOperationInfo info = infos[i];
final String name = info.getName();
final String returnType = info.getReturnType();
final MBeanParameterInfo[] paramInfos = info.getSignature();
final String[] paramTypes = new String[paramInfos.length];
for (int p = 0; p < paramInfos.length; ++p) {
paramTypes[p] = paramInfos[p].getType();
}
final String[] paramNames = getParamNames(info);
if (mEmitComments) {
final String comment = getOperationComment(info, paramNames);
if (comment.length() != 0) {
buf.append(NEWLINE + indent(comment) + NEWLINE);
}
}
final String method = formMethod(returnType, name, paramTypes, paramNames);
buf.append(indent(method) + NEWLINE);
}
return (buf.toString());
}
Aggregations