?? libraryexception.java
字號:
package cn.hxex.library.exception;
/**
* 異常類
*
* @author galaxy
*
*/
public class LibraryException extends Exception {
static final String USERNAME_NOT_EXIST = "userBean_no_existing_username";
static final String INCORRECT_PASSWORD = "userBean_incorrect_password";
static final String CATEGORY_NAME_DUPLICATE = "categoryBean_duplicate_category_name";
static final String CATEGORY_NOT_EXIST = "categoryBean_not_existing_category";
static final String CATEGORY_EXIST_PRODUCT = "categoryBean_existing_product";
static final String PRODUCT_NAME_DUPLICATE = "productBean_duplicate_product_name";
static final String PRODUCT_NOT_EXIST = "productBean_not_existing_product";
static final String RECORD_NOT_EXIST = "recordBean_not_existing_record";
/**
* Constructor with error message.
*
* @param msg
* the error message associated with the exception
*/
public LibraryException(String msg) {
super(msg);
}
/**
* Constructor with error message and root cause.
*
* @param msg
* the error message associated with the exception
* @param cause
* the root cause of the exception
*/
public LibraryException(String msg, Throwable cause) {
super(msg, cause);
}
public static LibraryException getDuplicateCategoryNameException() {
return new LibraryException(CATEGORY_NAME_DUPLICATE);
}
public static LibraryException getCategoryNotExistException() {
return new LibraryException(CATEGORY_NOT_EXIST);
}
public static LibraryException getCategoryExistProductException() {
return new LibraryException(CATEGORY_EXIST_PRODUCT);
}
public static LibraryException getUsernameNotExistException() {
return new LibraryException(USERNAME_NOT_EXIST);
}
public static LibraryException getIncorrectPasswordException() {
return new LibraryException(INCORRECT_PASSWORD);
}
public static LibraryException getDuplicateProductNameException() {
return new LibraryException(PRODUCT_NAME_DUPLICATE);
}
public static LibraryException getProductNotExistException() {
return new LibraryException(PRODUCT_NOT_EXIST);
}
public static LibraryException getRecordNotExistException() {
return new LibraryException(RECORD_NOT_EXIST);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -