1 package org.iotivity.cloud.base.protocols.coap.enums;
3 public enum CoapStatus {
5 CREATED(65), DELETED(66), VALID(67), CHANGED(68), CONTENT(69),
7 BAD_REQUEST(128), UNAUTHORIZED(129), BAD_OPTION(130), FORBIDDEN(131),
9 NOT_FOUND(132), METHOD_NOT_ALLOWED(133), NOT_ACCEPTABLE(134),
11 PRECONDITION_FAILED(140), REQUEST_ENTITY_TOO_LARGE(141),
13 UNSUPPORTED_CONTENT_FORMAT(143),
15 INTERNAL_SERVER_ERROR(160), NOT_IMPLEMENTED(161), BAD_GATEWAY(162),
17 SERVICE_UNAVAILABLE(163), GATEWAY_TIMEOUT(164), PROXY_NOT_SUPPORTED(165);
19 public static CoapStatus valueOf(int code) {
22 return CoapStatus.CREATED;
25 return CoapStatus.DELETED;
28 return CoapStatus.VALID;
31 return CoapStatus.CHANGED;
34 return CoapStatus.CONTENT;
37 return CoapStatus.BAD_REQUEST;
40 return CoapStatus.UNAUTHORIZED;
43 return CoapStatus.BAD_OPTION;
46 return CoapStatus.FORBIDDEN;
49 return CoapStatus.NOT_FOUND;
52 return CoapStatus.METHOD_NOT_ALLOWED;
55 return CoapStatus.NOT_ACCEPTABLE;
58 return CoapStatus.PRECONDITION_FAILED;
61 return CoapStatus.REQUEST_ENTITY_TOO_LARGE;
64 return CoapStatus.UNSUPPORTED_CONTENT_FORMAT;
67 return CoapStatus.INTERNAL_SERVER_ERROR;
70 return CoapStatus.NOT_IMPLEMENTED;
73 return CoapStatus.BAD_GATEWAY;
76 return CoapStatus.SERVICE_UNAVAILABLE;
79 return CoapStatus.GATEWAY_TIMEOUT;
82 return CoapStatus.PROXY_NOT_SUPPORTED;
85 throw new IllegalArgumentException("Invalid Status value");
88 private final int code;
90 private CoapStatus(int code) {
94 public int getCode() {