📄 exceptionevent.java
字号:
/* * Copyright (c) 2003, The Regents of the University of California, through * Lawrence Berkeley National Laboratory (subject to receipt of any required * approvals from the U.S. Dept. of Energy). All rights reserved. */package gov.lbl.dsd.sea.event;import gov.lbl.dsd.sea.Stage;/** * A generic runtime exception that can be thrown when a problem occurs within * {@link gov.lbl.dsd.sea.EventHandler#handle(java.lang.Object)}. * <p> * If appropriate, you can enqueue an instance of this class onto a stage. * * @author whoschek@lbl.gov * @author $Author: hoschek3 $ * @version $Revision: 1.2 $, $Date: 2004/07/22 18:04:54 $ */public class ExceptionEvent extends RuntimeException { protected Object causingEvent; protected Stage source; /** * Constructs a new exception. * * @param causingEvent * the event that caused the exception. * @param source * the stage that could not properly handle the causing event. */ public ExceptionEvent(Object causingEvent, Stage source) { this(null, null, causingEvent, source); } /** * Constructs a new exception. * * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A <tt>null</tt> value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @param causingEvent * the event that caused the exception. * @param source * the stage that could not properly handle the causing event. */ public ExceptionEvent(Throwable cause, Object causingEvent, Stage source) { this(null, cause, causingEvent, source); } /** * Constructs a new exception. * * @param message * the detail message. The detail message is saved for later * retrieval by the {@link #getMessage()}method. * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A <tt>null</tt> value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @param causingEvent * the event that caused the exception. * @param source * the stage that could not properly handle the causing event. */ public ExceptionEvent(String message, Throwable cause, Object causingEvent, Stage source) { super(message, cause); this.causingEvent = causingEvent; this.source = source; } public Object getCausingEvent() { return this.causingEvent; } public Stage getSource() { return this.source; } public String toString() { String str = super.toString(); if (getCausingEvent() != null) str = str + ", causingEventType=" + getCausingEvent().getClass().getName(); if (getCausingEvent() != null) str = str + ", causingEvent=" + getCausingEvent(); if (getSource() != null) str = str + ", source=" + getSource(); return str; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -