本文整理匯總了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);
}
}