⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 baseexception.java

📁 有关医院方向的开发
💻 JAVA
字号:
package com.dc.common;

import java.util.List;
import java.util.ArrayList;
import java.io.PrintStream;
import java.io.PrintWriter;

/**
 * Exception 基类
 * 
 * @author tangsz
 */
public class BaseException extends Exception
{
	private static final long serialVersionUID = -960185495264426709L;
	
	public static final long ERROR_PAGE = 1;
	public static final long RETURN_PAGE = 2;
	public static final long RETURN_BYPAGE = 3;
//	public static final long JS_DISPLAY = 4;

	private Throwable rootCause = null;

	private List exceptions = new ArrayList();

	private List messageArgs = new ArrayList();

	private String messageKey = null;
	
	private long displayType = ERROR_PAGE;
	
	private String returnForward = null;

	protected BaseException()
	{
		super();
	}
	protected BaseException(String errmsg)
	{
		this.messageArgs.add(errmsg);
	}
	protected BaseException(Throwable cause)
	{
		this.rootCause = cause;
	}
	protected BaseException(String errmsg,Throwable cause)
	{
		this.messageArgs.add(errmsg);
		this.rootCause = cause;
	}
	protected BaseException(List args)
	{
		this.messageArgs = args;
	}
	protected BaseException(String msgKey,List args)
	{
		this.messageKey = msgKey;
		this.messageArgs = args;
	}

	public void printStackTrace(PrintWriter writer)
	{
		super.printStackTrace(writer);
		if (getRootCause() != null)
		{
			getRootCause().printStackTrace(writer);
		}
		writer.flush();
	}

	public void printStackTrace(PrintStream outStream)
	{
		printStackTrace(new PrintWriter(outStream));
	}

	public void printStackTrace()
	{
		printStackTrace(System.err);
	}

	public Throwable getRootCause()
	{
		return rootCause;
	}

	public String getMessageKey()
	{
		return messageKey;
	}
	public List getExceptions()
	{
		return exceptions;
	}

	public void addException(BaseException ex)
	{
		exceptions.add(ex);
	}

	public List getMessageArgs()
	{
		return messageArgs;
	}

	public long getDisplayType()
	{
		return displayType;
	}

	public void setDisplayType(long displayType)
	{
		this.displayType = displayType;
	}

	public String getReturnForward()
	{
		return returnForward;
	}

	public void setReturnForward(String returnForward)
	{
		this.returnForward = returnForward;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -