当前位置: 首页>>代码示例>>Java>>正文


Java ArgumentConvertingMethodInvoker类代码示例

本文整理汇总了Java中org.springframework.beans.support.ArgumentConvertingMethodInvoker的典型用法代码示例。如果您正苦于以下问题:Java ArgumentConvertingMethodInvoker类的具体用法?Java ArgumentConvertingMethodInvoker怎么用?Java ArgumentConvertingMethodInvoker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ArgumentConvertingMethodInvoker类属于org.springframework.beans.support包,在下文中一共展示了ArgumentConvertingMethodInvoker类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.springframework.beans.support.ArgumentConvertingMethodInvoker; //导入依赖的package包/类
/** {@inheritDoc} */
public Object execute(String method, @SuppressWarnings("unchecked") Vector params) throws Exception {
    
    log().debug("calling: "+method+'('+toArgList(params)+')');
    
    MethodInvoker invoker = new ArgumentConvertingMethodInvoker();
    invoker.setTargetObject(this.proxy);
    invoker.setTargetMethod(getMethodName(method));
    invoker.setArguments(params.toArray());
    invoker.prepare();
    
    try {
    Object returnValue =  invoker.invoke();
    
    if (returnValue == null && invoker.getPreparedMethod().getReturnType() == Void.TYPE) {
        returnValue = "void";
    }
    
    else if (returnValue instanceof Map<?,?> && !(returnValue instanceof Hashtable<?,?>)) {
        returnValue = new Hashtable<Object, Object>((Map<?, ?>)returnValue);
    }
    
    else if (returnValue instanceof Collection<?> && !(returnValue instanceof Vector<?>)) {
        returnValue = new Vector<Object>((Collection<?>)returnValue);
    }
    
    log().debug("returning from: "+method+'('+toArgList(params)+") result = "+returnValue);
    return returnValue;
    
    } catch (InvocationTargetException e) {
        Throwable targetException = e.getTargetException();
        if (targetException instanceof IllegalArgumentException) {
            throw new MsgPreservingXmlRpcException(XmlRpcConstants.FAULT_INVALID_DATA, targetException.getMessage());
        } else if (targetException instanceof MalformedURLException) {
            throw new MsgPreservingXmlRpcException(XmlRpcConstants.FAULT_INVALID_URL, targetException.getMessage());
        }
        else if (targetException instanceof Exception && targetException.toString() != null) { 
            throw (Exception)targetException;
        }
        
        String msg = targetException.toString();
        if (msg == null)
            msg = targetException.getClass().getName();
        
        Exception ex = new Exception(msg, targetException);
        ex.setStackTrace(targetException.getStackTrace());
        throw ex;
    }

}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:51,代码来源:XmlRpcServiceExporter.java


注:本文中的org.springframework.beans.support.ArgumentConvertingMethodInvoker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。