您的位置:首页 > 编程语言 > Java开发

Java异常处理的基本封装

2006-06-08 14:32 295 查看
以下是本人对EXCEPTION的基本封装,以后的异常继承此BASE类,继续扩展.给大家一个异常初步的编写.

package jp.co.yachiyobank.inf.com.frw.baseExp;

import java.io.PrintStream;
import java.io.PrintWriter;

public class BaseException extends Exception{

private static final long serialVersionUID = 1L;

private Throwable throwable;

/**
* クラスのコンストラクタ
* @param なし
*/
public BaseException(){
super();
}

/**
* クラスのコンストラクタ
* @param msg エラーメッセージ
*/
public BaseException(String msg){
super(msg);

}

/**
* クラスのコンストラクタ
* @param msg エラーメッセージ
* @param throwable
*/
public BaseException(String msg,Throwable throwable){
super(msg,throwable);
}

/**
*
* @param なし
*/
public Throwable getException(){
throwable=super.getCause();

return throwable;
}

/**
*
* @param なし
*/
public void printStackTrace(){
super.printStackTrace();
}

/**
*
* @param printStream
*/
public void printStackTrace(PrintStream printStream){
super.printStackTrace(printStream);
}

/**
*
* @param printWriter
*/
public void printStackTrace(PrintWriter printWriter){
super.printStackTrace(printWriter);

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: