au.org.consumerdatastandards.support.ResponseCode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-model Show documentation
Show all versions of api-model Show documentation
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.
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