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


Java InvocationTargetException.addSuppressed方法代码示例

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


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

示例1: invokeMethod

import java.lang.reflect.InvocationTargetException; //导入方法依赖的package包/类
/**
 * Invokes component method through
 * {@code SwingUtilities.invokeAndWait(Runnable)}.
 *
 * @param method_name Name of a method to be invoked
 * @param params Method params
 * @param params_classes Method params' classes
 * @return an Object - methods result.
 * @see org.netbeans.jemmy.ClassReference
 * @exception IllegalAccessException
 * @exception NoSuchMethodException
 * @exception IllegalStateException
 * @exception InvocationTargetException
 */
public Object invokeMethod(String method_name, Object[] params, Class<?>[] params_classes)
        throws InvocationTargetException, IllegalStateException, NoSuchMethodException, IllegalAccessException {
    Invoker invk = new Invoker(method_name, params, params_classes);
    try {
        return queueTool.invokeAndWait(invk);
    } catch (JemmyException e) {
        Exception ex = invk.getException();
        if (ex != null) {
            if (ex instanceof InvocationTargetException) {
                InvocationTargetException ite = (InvocationTargetException) ex;
                ite.addSuppressed(e);
                throw ite;
            } else if (ex instanceof IllegalStateException) {
                IllegalStateException ise = (IllegalStateException) ex;
                ise.addSuppressed(e);
                throw ise;
            } else if (ex instanceof NoSuchMethodException) {
                NoSuchMethodException nsme = (NoSuchMethodException) ex;
                nsme.addSuppressed(e);
                throw nsme;
            } else if (ex instanceof IllegalAccessException) {
                IllegalAccessException iae = (IllegalAccessException) ex;
                iae.addSuppressed(e);
                throw iae;
            } else {
                e.addSuppressed(ex);
            }
        }
        throw (e);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:46,代码来源:EventDispatcher.java

示例2: getField

import java.lang.reflect.InvocationTargetException; //导入方法依赖的package包/类
/**
 * Gets component field value through
 * {@code SwingUtilities.invokeAndWait(Runnable)}.
 *
 * @param field_name Name of a field
 * @see #setField(String, Object)
 * @see org.netbeans.jemmy.ClassReference
 * @return an Object - field value
 * @exception IllegalAccessException
 * @exception IllegalStateException
 * @exception InvocationTargetException
 * @exception NoSuchFieldException
 */
public Object getField(String field_name)
        throws InvocationTargetException, IllegalStateException, NoSuchFieldException, IllegalAccessException {
    Getter gtr = new Getter(field_name);
    try {
        return queueTool.invokeAndWait(gtr);
    } catch (JemmyException e) {
        Exception ex = gtr.getException();
        if (ex != null) {
            if (ex instanceof InvocationTargetException) {
                InvocationTargetException ite = (InvocationTargetException) ex;
                ite.addSuppressed(e);
                throw ite;
            } else if (ex instanceof IllegalStateException) {
                IllegalStateException ise = (IllegalStateException) ex;
                ise.addSuppressed(e);
                throw ise;
            } else if (ex instanceof NoSuchFieldException) {
                NoSuchFieldException nsfe = (NoSuchFieldException) ex;
                nsfe.addSuppressed(e);
                throw nsfe;
            } else if (ex instanceof IllegalAccessException) {
                IllegalAccessException iae = (IllegalAccessException) ex;
                iae.addSuppressed(e);
                throw iae;
            } else {
                e.addSuppressed(ex);
            }
        }
        throw (e);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:45,代码来源:EventDispatcher.java

示例3: setField

import java.lang.reflect.InvocationTargetException; //导入方法依赖的package包/类
/**
 * Sets component field value through
 * {@code SwingUtilities.invokeAndWait(Runnable)}.
 *
 * @param field_name Name of a field
 * @param newValue New field value
 * @see #getField(String)
 * @see org.netbeans.jemmy.ClassReference
 * @exception IllegalAccessException
 * @exception IllegalStateException
 * @exception InvocationTargetException
 * @exception NoSuchFieldException
 */
public void setField(String field_name, Object newValue)
        throws InvocationTargetException, IllegalStateException, NoSuchFieldException, IllegalAccessException {
    Setter str = new Setter(field_name, newValue);
    try {
        queueTool.invokeAndWait(str);
    } catch (JemmyException e) {
        Exception ex = str.getException();
        if (ex != null) {
            if (ex instanceof InvocationTargetException) {
                InvocationTargetException ite = (InvocationTargetException) ex;
                ite.addSuppressed(e);
                throw ite;
            } else if (ex instanceof IllegalStateException) {
                IllegalStateException ise = (IllegalStateException) ex;
                ise.addSuppressed(e);
                throw ise;
            } else if (ex instanceof NoSuchFieldException) {
                NoSuchFieldException nsfe = (NoSuchFieldException) ex;
                nsfe.addSuppressed(e);
                throw nsfe;
            } else if (ex instanceof IllegalAccessException) {
                IllegalAccessException iae = (IllegalAccessException) ex;
                iae.addSuppressed(e);
                throw iae;
            } else {
                e.addSuppressed(ex);
            }
        }
        throw (e);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:45,代码来源:EventDispatcher.java


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