zoukankan      html  css  js  c++  java
  • 自定义基础异常类

    /**
     * 基础异常
     *
     * @author wjs
     * @date 2019/5/24
     */
    public class BaseException extends RuntimeException {
        private static final long serialVersionUID = 1L;
    
        /**
         * 所属模块
         */
        private String module;
    
        /**
         * 错误码
         */
        private String code;
    
        /**
         * 错误码对应的参数
         */
        private Object[] args;
    
        /**
         * 错误消息
         */
        private String defaultMessage;
    
        public BaseException(String module, String code, Object[] args, String defaultMessage) {
            this.module = module;
            this.code = code;
            this.args = args;
            this.defaultMessage = defaultMessage;
        }
    
        public BaseException(String module, String code, Object[] args) {
            this(module, code, args, null);
        }
    
        public BaseException(String module, String defaultMessage) {
            this(module, null, null, defaultMessage);
        }
    
        public BaseException(String code, Object[] args) {
            this(null, code, args, null);
        }
    
        public BaseException(String defaultMessage) {
            this(null, null, null, defaultMessage);
        }
    
        @Override
        public String getMessage() {
            return defaultMessage;
        }
    
        public String getCode() {
            return code;
        }
    
        public String getModule() {
            return module;
        }
    
        public Object[] getArgs() {
            return args;
        }
    
        public String getDefaultMessage() {
            return defaultMessage;
        }
    }
  • 相关阅读:
    2.App Components-Activities/Loadres
    2.App Components-Activities/Fragments
    2.App Components-Activities
    2.App Components-Intents and Intent Filters
    1.Indroduction
    Fragment
    用继承和组合方式定制控件
    复杂布局实现
    Android源代码下载与跟踪
    电梯调度算法模拟
  • 原文地址:https://www.cnblogs.com/w1440199392/p/15201145.html
Copyright © 2011-2022 走看看