枚举的定义方法

package com.hst.ces.mybatis.mybatis3.entity.meta;

import javax.ws.rs.core.Response.Status;

/**
 * @author dengxl
 */
public enum ValidationEnum {
    VALID("valid", "valid"),

    UNSUPPORTED_RESPONSE_TYPE("unsupported_response_type",
            String.format("The supported response_type values are '%s' and '%s'", "token", "code")),

    UNKNOWN_CLIENT_ID("unauthorized_client", "The client_id is unknown"),

    UNAUTHORIZED_CLIENT("unauthorized_client", "The client_id is unknown", Status.UNAUTHORIZED),

    IMPLICIT_GRANT_REDIRECT_URI("invalid_request", "For Implicit Grant the redirect_uri parameter is required"),

    REDIRECT_URI_REQUIRED("invalid_request",
            "Client has no registered redirect_uri, must provide run-time redirect_uri"),

    REDIRECT_URI_NOT_VALID("invalid_request",
            "The redirect_uri does not equal any of the registered redirect_uri values"),

    REDIRECT_URI_NOT_URI("invalid_request", "The redirect_uri is not a valid URI"),

    REDIRECT_URI_DIFFERENT("invaid_request", "The redirect_uri does not match the initial authorization request"),

    SCOPE_NOT_VALID("invalid_scope", "The requested scope is invalid, unknown, malformed, "
            + "or exceeds the scope granted by the resource owner."),

    IMPLICIT_GRANT_NOT_PERMITTED("unsupported_response_type", "The client has no permisssion for implicit grant"),

    CLIENT_CREDENTIALS_NOT_PERMITTED("unauthorized_client", "The client has no permisssion for client credentials"),

    REDIRECT_URI_FRAGMENT_COMPONENT("invalid_request",
            "The redirect_uri endpoint must not include a fragment component"),

    UNSUPPORTED_GRANT_TYPE("unsupported_grant_type",
            String.format("The supported grant_type values are '%s' and '%s'", "authorization_code", "refresh_token")),

    INVALID_GRANT_AUTHORIZATION_CODE("invalid_grant", "The authorization code is invalid"),

    INVALID_GRANT_REFRESH_TOKEN("invalid_grant", "The refresh token is invalid", Status.UNAUTHORIZED),

    INVALID_GRANT_CLIENT_CREDENTIALS("invalid_grant", "The client is invalid"),

    INVALID_GRANT_PASSWORD("invalid_grant", "The resource owners credentials must be provided", Status.UNAUTHORIZED),

    INVALID_GRANT_THIRDPARTY_QQ("invalid_grant", "The openid must be binding"),

    UNKNOWN_ERROR("unknown_error", "unknown_error");

    private String value;
    private String description;
    private Status status;

    ValidationEnum(String value, String description) {
        this(value, description, Status.BAD_REQUEST);
    }

    ValidationEnum(String value, String description, Status status) {
        this.value = value;
        this.description = description;
        this.status = status;
    }

    public String getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }

    public Status getStatus() {
        return status;
    }
}

参考链接

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

bst@微胖子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值