本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}