All Downloads are FREE. Search and download functionalities are using the official Maven repository.

win.doyto.query.web.response.PresetErrorCode Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
// Generated by delombok at Sat Apr 04 14:54:36 CST 2020
package win.doyto.query.web.response;

/**
 * PresetErrorCode
 *
 * @author f0rb
 */
public enum PresetErrorCode implements ErrorCode {
    SUCCESS(0, "访问成功"), ERROR(1, "系统内部异常"), REQUEST_BODY_ERROR(2, "请求内容异常"), ARGUMENT_TYPE_MISMATCH(3, "参数类型异常"), ARGUMENT_FORMAT_ERROR(4, "参数格式错误: %s"), ARGUMENT_VALIDATION_FAILED(5, "参数校验失败"), HTTP_METHOD_NOT_SUPPORTED(6, "该接口不支持%s请求"), DUPLICATE_KEY_EXCEPTION(7, "相同字段或组合已存在"), FILE_UPLOAD_OVER_MAX_SIZE(8, "文件超过指定大小"), ENTITY_NOT_FOUND(9, "查询记录不存在");
    private final Integer code;
    private final String message;
    private final ThreadLocal args = new ThreadLocal<>();

    public String getMessage() {
        try {
            Object[] t = this.args.get();
            return t != null ? String.format(message, t) : message;
        } finally {
            this.args.remove();
        }
    }

    public PresetErrorCode args(Object... args) {
        this.args.set(args);
        return this;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    private PresetErrorCode(final Integer code, final String message) {
        this.code = code;
        this.message = message;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public Integer getCode() {
        return this.code;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy