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

au.org.consumerdatastandards.support.ResponseCode Maven / Gradle / Ivy

Go to download

This artefact describes the Consumer Data Standards using Java classes and annotations in a way suitable for automatic generation of Open API Specification, documentation, Server Stub, Client Libraries and Reference Test.

There is a newer version: 1.1.1
Show newest version
package au.org.consumerdatastandards.support;

/**
 *  This enum defines a subset of HTTP response codes specified in
 *  RFC7231 and
 *  RFC7235
 *  These codes may be used in responses defined in CDS
 *
 */
public enum ResponseCode {
    OK(200),
    CREATED(201),
    ACCEPTED(202),
    NO_CONTENT(204),
    BAD_REQUEST(400),
    UNAUTHORIZED(401),
    FORBIDDEN(403),
    UNPROCESSABLE_ENTITY(422),
    TOO_MANY_REQUESTS(429);

    int code;

    ResponseCode(int code) {
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public static ResponseCode fromCode(int code) {
        for (ResponseCode responseCode : values()) {
            if (responseCode.code == code) {
                return responseCode;
            }
        }
        return null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy