Commit cae107f8 authored by yanzg's avatar yanzg

修改实例化关系

parent f79c6734
...@@ -5,37 +5,7 @@ package com.yanzuoguang.util.exception; ...@@ -5,37 +5,7 @@ package com.yanzuoguang.util.exception;
* *
* @author 颜佐光 * @author 颜佐光
*/ */
public class CodeException extends RuntimeException { public class CodeException extends RuntimeCodeError {
private static final long serialVersionUID = -4625832188480820883L;
/**
* 错误码
*/
private String code = "99";
/**
* 包含的数据
*/
private Object target = null;
/**
* 获取错误码
*
* @return 返回的结果
*/
public String getCode() {
return this.code;
}
/**
* 来源数据
*
* @return
*/
public Object getTarget() {
return target;
}
/** /**
* Constructs a new runtime exception with the specified detail message and * Constructs a new runtime exception with the specified detail message and
...@@ -54,8 +24,7 @@ public class CodeException extends RuntimeException { ...@@ -54,8 +24,7 @@ public class CodeException extends RuntimeException {
* @since 1.4 * @since 1.4
*/ */
public CodeException(String code, String message, Throwable cause) { public CodeException(String code, String message, Throwable cause) {
super(message, cause); super(code, message, cause);
this.code = code;
} }
/** /**
...@@ -67,8 +36,7 @@ public class CodeException extends RuntimeException { ...@@ -67,8 +36,7 @@ public class CodeException extends RuntimeException {
* @param target  错误数据源,如订单数据 * @param target  错误数据源,如订单数据
*/ */
public CodeException(String message, Object target) { public CodeException(String message, Object target) {
super(message); super(message, target);
this.target = target;
} }
/** /**
...@@ -84,8 +52,7 @@ public class CodeException extends RuntimeException { ...@@ -84,8 +52,7 @@ public class CodeException extends RuntimeException {
* unknown.) * unknown.)
*/ */
public CodeException(String message, Object target, Throwable cause) { public CodeException(String message, Object target, Throwable cause) {
super(message, cause); super(message, target, cause);
this.target = target;
} }
/** /**
...@@ -98,9 +65,7 @@ public class CodeException extends RuntimeException { ...@@ -98,9 +65,7 @@ public class CodeException extends RuntimeException {
* @param target  错误数据源,如订单数据 * @param target  错误数据源,如订单数据
*/ */
public CodeException(String code, String message, Object target) { public CodeException(String code, String message, Object target) {
super(message); super(code, message, target);
this.code = code;
this.target = target;
} }
/** /**
...@@ -117,9 +82,7 @@ public class CodeException extends RuntimeException { ...@@ -117,9 +82,7 @@ public class CodeException extends RuntimeException {
* unknown.) * unknown.)
*/ */
public CodeException(String code, String message, Object target, Throwable cause) { public CodeException(String code, String message, Object target, Throwable cause) {
super(message, cause); super(code, message, target, cause);
this.code = code;
this.target = target;
} }
/** /**
...@@ -161,8 +124,7 @@ public class CodeException extends RuntimeException { ...@@ -161,8 +124,7 @@ public class CodeException extends RuntimeException {
* later retrieval by the {@link #getMessage()} method. * later retrieval by the {@link #getMessage()} method.
*/ */
public CodeException(String code, String message) { public CodeException(String code, String message) {
super(message); super(code, message);
this.code = code;
} }
/** /**
......
package com.yanzuoguang.util.exception;
/**
* @author 异常错误
*/
public class RuntimeCodeError extends RuntimeException {
/**
* 错误码
*/
private String code = "99";
/**
* 包含的数据
*/
private Object target = null;
/**
* 获取错误码
*
* @return 返回的结果
*/
public String getCode() {
return this.code;
}
/**
* 来源数据
*
* @return
*/
public Object getTarget() {
return target;
}
/**
* Constructs a new runtime exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this runtime exception's detail message.
*
* @param code the detail code (which is saved for later retrieval
* by the {@link #getCode()} method).
* @param message the detail message (which 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.)
* @since 1.4
*/
public RuntimeCodeError(String code, String message, Throwable cause) {
super(message, cause);
this.code = code;
}
/**
* 构造函数
* throw new CodeException("01","该订单已过期",order);
* throw new CodeException("02","该订单未到使用时间",order);
*
* @param message  错误消息
* @param target  错误数据源,如订单数据
*/
public RuntimeCodeError(String message, Object target) {
super(message);
this.target = target;
}
/**
* 构造函数
* throw new CodeException("01","该订单已过期",order);
* throw new CodeException("02","该订单未到使用时间",order);
*
* @param message  错误消息
* @param target  错误数据源,如订单数据
* @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.)
*/
public RuntimeCodeError(String message, Object target, Throwable cause) {
super(message, cause);
this.target = target;
}
/**
* 构造函数
* throw new CodeException("01","该订单已过期",order);
* throw new CodeException("02","该订单未到使用时间",order);
*
* @param code  错误码
* @param message  错误消息
* @param target  错误数据源,如订单数据
*/
public RuntimeCodeError(String code, String message, Object target) {
super(message);
this.code = code;
this.target = target;
}
/**
* 构造函数
* throw new CodeException("01","该订单已过期",order);
* throw new CodeException("02","该订单未到使用时间",order);
*
* @param code  错误码
* @param message  错误消息
* @param target  错误数据源,如订单数据
* @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.)
*/
public RuntimeCodeError(String code, String message, Object target, Throwable cause) {
super(message, cause);
this.code = code;
this.target = target;
}
/**
* Constructs a new runtime exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this runtime exception's detail message.
*
* @param message the detail message (which 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.)
* @since 1.4
*/
public RuntimeCodeError(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructs a new runtime exception with {@code null} as its
* detail message. The cause is not initialized, and may subsequently be
* initialized by a call to {@link #initCause}.
*/
public RuntimeCodeError() {
super();
}
/**
* Constructs a new runtime exception with the specified detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*
* @param code the detail code (which is saved for later retrieval
* by the {@link #getCode()} method).
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public RuntimeCodeError(String code, String message) {
super(message);
this.code = code;
}
/**
* Constructs a new runtime exception with the specified detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public RuntimeCodeError(String message) {
super(message);
}
/**
* Constructs a new runtime exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this runtime exception's detail message.
*
* @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.)
* @since 1.4
*/
public RuntimeCodeError(Throwable cause) {
super(cause);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment