AbstractDynamicWrapper.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:hashsdn-controller 作者:
@Override
public Object invoke(final String actionName, final Object[] params, final String[] signature)
        throws MBeanException, ReflectionException {
    if ("getAttribute".equals(actionName) && params.length == 1 && signature[0].equals(String.class.getName())) {
        try {
            return getAttribute((String) params[0]);
        } catch (final AttributeNotFoundException e) {
            throw new MBeanException(e, "Attribute not found on " + moduleIdentifier);
        }
    } else if ("getAttributes".equals(actionName) && params.length == 1
            && signature[0].equals(String[].class.getName())) {
        return getAttributes((String[]) params[0]);
    } else if ("setAttributes".equals(actionName) && params.length == 1
            && signature[0].equals(AttributeList.class.getName())) {
        return setAttributes((AttributeList) params[0]);
    } else {
        LOG.debug("Operation not found {} ", actionName);
        throw new UnsupportedOperationException(String.format(
                "Operation not found on %s. Method invoke is only supported for getInstance and getAttribute(s) "
                        + "method, got actionName %s, params %s, signature %s ",
                moduleIdentifier, actionName, params, signature));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号