注解定义支持指定代表处理成功的code码, 不指定默认为0

This commit is contained in:
白茶清欢 2025-06-02 07:27:47 +08:00
parent abd808b9f1
commit fc48259497

View File

@ -8,6 +8,7 @@ import java.lang.annotation.*;
@Target(ElementType.TYPE) // 注解会施加在自定义异常类之上
@Inherited // @Inherited注解表示注解类型被自动继承如果一个类被标注了@Inherited那么它的子类也会继承该注解
public @interface CustomExceptionAnnotation {
String exceptionPackageList() default ""; // 哪些包下定义了异常类, 多个包路径用 , 分隔
String exceptionClassList() default ""; // 异常类路径, 多个类用 , 分隔
String[] exceptionPackageList() default {}; // 哪些包下定义了异常类, 多个包路径用 , 分隔
String[] exceptionClassList() default {}; // 异常类路径, 多个类用 , 分隔
String successCode() default "0"; // 代表成功的处理码, 默认值 0
}