📄 businessexception.java
字号:
package edu.buptsse.sxjd.service;
import java.util.List;
import java.util.ArrayList;
import java.io.PrintStream;
import java.io.PrintWriter;
/**
*本类来源于孙卫琴的书,如不明白请请参照该书的讲解来理解
* @author sun wei qin
* 2007-1-10
*/
public class BusinessException extends Exception {
protected Throwable rootCause = null;
private List exceptions = new ArrayList();
private String messageKey = null;
private Object[] messageArgs = null;
public BusinessException() {
super();
}
public BusinessException(Throwable rootCause) {
this.rootCause = rootCause;
}
public List getExceptions() {
return exceptions;
}
@SuppressWarnings("unchecked")
public void addException(BusinessException ex) {
exceptions.add(ex);
}
public void setMessageKey(String key) {
this.messageKey = key;
}
public String getMessageKey() {
return messageKey;
}
public void setMessageArgs(Object[] args) {
this.messageArgs = args;
}
public Object[] getMessageArgs() {
return messageArgs;
}
public void setRootCause(Throwable anException) {
rootCause = anException;
}
public Throwable getRootCause() {
return rootCause;
}
public void printStackTrace() {
printStackTrace(System.err);
}
public void printStackTrace(PrintStream outStream) {
printStackTrace(new PrintWriter(outStream));
}
public void printStackTrace(PrintWriter writer) {
super.printStackTrace(writer);
if (getRootCause() != null) {
getRootCause().printStackTrace(writer);
}
writer.flush();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -