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


Java InvokerInvocationException.getCause方法代码示例

本文整理汇总了Java中org.codehaus.groovy.runtime.InvokerInvocationException.getCause方法的典型用法代码示例。如果您正苦于以下问题:Java InvokerInvocationException.getCause方法的具体用法?Java InvokerInvocationException.getCause怎么用?Java InvokerInvocationException.getCause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.codehaus.groovy.runtime.InvokerInvocationException的用法示例。


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

示例1: execute

import org.codehaus.groovy.runtime.InvokerInvocationException; //导入方法依赖的package包/类
public void execute(Task task) {
    closure.setDelegate(task);
    closure.setResolveStrategy(Closure.DELEGATE_FIRST);
    ClassLoader original = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(closure.getClass().getClassLoader());
    try {
        if (closure.getMaximumNumberOfParameters() == 0) {
            closure.call();
        } else {
            closure.call(task);
        }
    } catch (InvokerInvocationException e) {
        Throwable cause = e.getCause();
        if (cause instanceof RuntimeException) {
            throw (RuntimeException) cause;
        }
        throw e;
    } finally {
        Thread.currentThread().setContextClassLoader(original);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:22,代码来源:AbstractTask.java

示例2: callControllerAwareMethod

import org.codehaus.groovy.runtime.InvokerInvocationException; //导入方法依赖的package包/类
/**
 * Check whether the script declares a method with the given name that takes a
 * corpus parameter, and if so, call it passing the corpus from the given
 * controller. If the controller is not a CorpusController, do nothing.
 *
 * @throws ExecutionException
 *           if the script method throws an ExecutionException we re-throw it
 */
protected void callControllerAwareMethod(String methodName, Controller c)
        throws ExecutionException {
  if(!(c instanceof CorpusController)) { return; }
  List<MetaMethod> metaMethods =
          groovyScript.getMetaClass().respondsTo(groovyScript, methodName,
                  new Class[]{gate.Corpus.class});
  if(!metaMethods.isEmpty()) {
    try {
      metaMethods.get(0).invoke(groovyScript,
              new Corpus[]{((CorpusController)c).getCorpus()});
    } catch(InvokerInvocationException iie) {
      if(iie.getCause() instanceof ExecutionException) {
        throw (ExecutionException)iie.getCause();
      } else if(iie.getCause() instanceof RuntimeException) {
        throw (RuntimeException)iie.getCause();
      } else if(iie.getCause() instanceof Error) {
        throw (Error)iie.getCause();
      } else {
        throw iie;
      }
    }
  }
}
 
开发者ID:KHP-Informatics,项目名称:ADRApp,代码行数:32,代码来源:ScriptPR.java

示例3: getProperty

import org.codehaus.groovy.runtime.InvokerInvocationException; //导入方法依赖的package包/类
public Object getProperty(String name) throws MissingPropertyException {
    if (!includeProperties) {
        throw propertyMissingException(name);
    }

    MetaProperty property = getMetaClass().hasProperty(bean, name);
    if (property == null) {
        return getMetaClass().invokeMissingProperty(bean, name, null, true);
    }
    if (property instanceof MetaBeanProperty && ((MetaBeanProperty) property).getGetter() == null) {
        throw new GroovyRuntimeException(String.format(
                "Cannot get the value of write-only property '%s' on %s.", name, getDisplayName()));
    }

    try {
        return property.getProperty(bean);
    } catch (InvokerInvocationException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException) e.getCause();
        }
        throw e;
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:24,代码来源:BeanDynamicObject.java

示例4: callClosure

import org.codehaus.groovy.runtime.InvokerInvocationException; //导入方法依赖的package包/类
public static Object callClosure(Closure closure, Object... args) {
    try {
        return closure.call(args);
    } catch (InvokerInvocationException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException)e.getCause();
        } else {
            throw e;
        }
    }
}
 
开发者ID:oehf,项目名称:ipf-flow-manager,代码行数:12,代码来源:ClosureAdapter.java

示例5: setBeanProperty

import org.codehaus.groovy.runtime.InvokerInvocationException; //导入方法依赖的package包/类
private void setBeanProperty(Object newValue) {
    try {
        propertyAccessor().write(bean, propertyName, newValue);
    } catch (InvokerInvocationException iie) {
        if (!(iie.getCause() instanceof PropertyVetoException)) {
            throw iie;
        }
        // ignore veto exceptions, just let the binding fail like a validation does
    }
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:11,代码来源:PropertyBinding.java

示例6: call

import org.codehaus.groovy.runtime.InvokerInvocationException; //导入方法依赖的package包/类
static <T> T call(Closure<T> closure, Object... args) {
    try {
        return closure.call(args);
    } catch (InvokerInvocationException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException) e.getCause();
        } else {
            throw e;
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:ClosureSupport.java

示例7: setProperty

import org.codehaus.groovy.runtime.InvokerInvocationException; //导入方法依赖的package包/类
public void setProperty(final String name, Object value) throws MissingPropertyException {
    if (!includeProperties) {
        throw propertyMissingException(name);
    }

    MetaClass metaClass = getMetaClass();
    MetaProperty property = metaClass.hasProperty(bean, name);
    if (property == null) {
        getMetaClass().invokeMissingProperty(bean, name, null, false);
    }

    if (property instanceof MetaBeanProperty && ((MetaBeanProperty) property).getSetter() == null) {
        throw new ReadOnlyPropertyException(name, bean.getClass()) {
            @Override
            public String getMessage() {
                return String.format("Cannot set the value of read-only property '%s' on %s.", name,
                        getDisplayName());
            }
        };
    }
    try {

        // Attempt type coercion before trying to set the property
        value = argsTransformer.transform(bean, MetaProperty.getSetterName(name), value)[0];

        metaClass.setProperty(bean, name, value);
    } catch (InvokerInvocationException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException) e.getCause();
        }
        throw e;
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:34,代码来源:BeanDynamicObject.java

示例8: invokeMethod

import org.codehaus.groovy.runtime.InvokerInvocationException; //导入方法依赖的package包/类
public Object invokeMethod(final String name, final Object... arguments) throws MissingMethodException {
    try {
        return getMetaClass().invokeMethod(bean, name, arguments);
    } catch (InvokerInvocationException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException) e.getCause();
        }
        throw e;
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:11,代码来源:BeanDynamicObject.java

示例9: getPropertyFor

import org.codehaus.groovy.runtime.InvokerInvocationException; //导入方法依赖的package包/类
public static Object getPropertyFor(ScriptProperties script, String property){
    Object args = new Object[]{script, property};
    for (GroovyObject modifier : dynamicModifiers) try {
        return modifier.getMetaClass().invokeMethod(modifier, "getPropertyFor", args);
    } catch (InvokerInvocationException exception){
        if (exception.getCause() != PropertySelector.next) throw exception;
    } catch (MissingMethodException ignored){}
    throw PropertySelector.next;
}
 
开发者ID:DPOH-VAR,项目名称:VarScript,代码行数:10,代码来源:CallerScript.java

示例10: invokeMethodFor

import org.codehaus.groovy.runtime.InvokerInvocationException; //导入方法依赖的package包/类
public static Object invokeMethodFor(ScriptProperties script, String name, Object[] args){
    Object arguments = new Object[]{script, name, args};
    for (GroovyObject modifier : dynamicModifiers) try {
        return InvokerHelper.invokeMethod(modifier, "invokeMethodFor", arguments);
    } catch (InvokerInvocationException exception){
        if (exception.getCause() != PropertySelector.next) throw exception;
    } catch (MissingMethodException ignored){}
    throw PropertySelector.next;
}
 
开发者ID:DPOH-VAR,项目名称:VarScript,代码行数:10,代码来源:CallerScript.java


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