Example usage for javax.management.modelmbean ModelMBeanOperationInfo getSignature

List of usage examples for javax.management.modelmbean ModelMBeanOperationInfo getSignature

Introduction

In this page you can find the example usage for javax.management.modelmbean ModelMBeanOperationInfo getSignature.

Prototype

public MBeanParameterInfo[] getSignature() 

Source Link

Document

Returns the list of parameters for this operation.

Usage

From source file:net.lightbody.bmp.proxy.jetty.util.jmx.ModelMBeanImpl.java

/** Define an operation.
 * Explicit definition of an operation. Reflection is used to
 * locate method called.//from w ww.ja v a  2 s.  co m
 * @param opInfo 
 */
public synchronized void defineOperation(ModelMBeanOperationInfo opInfo) {
    _dirty = true;
    Class oClass = _object.getClass();

    try {
        MBeanParameterInfo[] pInfo = opInfo.getSignature();

        Class[] types = new Class[pInfo.length];
        String method = opInfo.getName() + "(";
        for (int i = 0; i < pInfo.length; i++) {
            Class type = TypeUtil.fromName(pInfo[i].getType());
            if (type == null)
                type = Thread.currentThread().getContextClassLoader().loadClass(pInfo[i].getType());
            types[i] = type;
            method += (i > 0 ? "," : "") + pInfo[i].getType();
        }
        method += ")";

        _method.put(method, oClass.getMethod(opInfo.getName(), types));
        _operations.add(opInfo);
    } catch (Exception e) {
        log.warn(LogSupport.EXCEPTION, e);
        throw new IllegalArgumentException(e.toString());
    }
}