Returns the status associated to a code. If an existing constant exists
then it is returned, otherwise a new instance is created.

@param code
The code.
@return The associated status.
975102
public static Status valueOf(int code) {
        Status result = null;

        switch (code) {
            case 100:
                result = INFO_CONTINUE;
                break;
            case 101:
                result = INFO_SWITCHING_PROTOCOL;
                break;
            case 102:
                result = INFO_PROCESSING;
                break;

            case 200:
                result = SUCCESS_OK;
                break;
            case 201:
                result = SUCCESS_CREATED;
                break;
            case 202:
                result = SUCCESS_ACCEPTED;
                break;
            case 203:
                result = SUCCESS_NON_AUTHORITATIVE;
                break;
            case 204:
                result = SUCCESS_NO_CONTENT;
                break;
            case 205:
                result = SUCCESS_RESET_CONTENT;
                break;
            case 206:
                result = SUCCESS_PARTIAL_CONTENT;
                break;
            case 207:
                result = SUCCESS_MULTI_STATUS;
                break;

            case 300:
                result = REDIRECTION_MULTIPLE_CHOICES;
                break;
            case 301:
                result = REDIRECTION_PERMANENT;
                break;
            case 302:
                result = REDIRECTION_FOUND;
                break;
            case 303:
                result = REDIRECTION_SEE_OTHER;
                break;
            case 304:
                result = REDIRECTION_NOT_MODIFIED;
                break;
            case 305:
                result = REDIRECTION_USE_PROXY;
                break;
            case 307:
                result = REDIRECTION_TEMPORARY;
                break;

            case 400:
                result = CLIENT_ERROR_BAD_REQUEST;
                break;
            case 401:
                result = CLIENT_ERROR_UNAUTHORIZED;
                break;
            case 402:
                result = CLIENT_ERROR_PAYMENT_REQUIRED;
                break;
            case 403:
                result = CLIENT_ERROR_FORBIDDEN;
                break;
            case 404:
                result = CLIENT_ERROR_NOT_FOUND;
                break;
            case 405:
                result = CLIENT_ERROR_METHOD_NOT_ALLOWED;
                break;
            case 406:
                result = CLIENT_ERROR_NOT_ACCEPTABLE;
                break;
            case 407:
                result = CLIENT_ERROR_PROXY_AUTHENTIFICATION_REQUIRED;
                break;
            case 408:
                result = CLIENT_ERROR_REQUEST_TIMEOUT;
                break;
            case 409:
                result = CLIENT_ERROR_CONFLICT;
                break;
            case 410:
                result = CLIENT_ERROR_GONE;
                break;
            case 411:
                result = CLIENT_ERROR_LENGTH_REQUIRED;
                break;
            case 412:
                result = CLIENT_ERROR_PRECONDITION_FAILED;
                break;
            case 413:
                result = CLIENT_ERROR_REQUEST_ENTITY_TOO_LARGE;
                break;
            case 414:
                result = CLIENT_ERROR_REQUEST_URI_TOO_LONG;
                break;
            case 415:
                result = CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE;
                break;
            case 416:
                result = CLIENT_ERROR_REQUESTED_RANGE_NOT_SATISFIABLE;
                break;
            case 417:
                result = CLIENT_ERROR_EXPECTATION_FAILED;
                break;
            case 422:
                result = CLIENT_ERROR_UNPROCESSABLE_ENTITY;
                break;
            case 423:
                result = CLIENT_ERROR_LOCKED;
                break;
            case 424:
                result = CLIENT_ERROR_FAILED_DEPENDENCY;
                break;

            case 500:
                result = SERVER_ERROR_INTERNAL;
                break;
            case 501:
                result = SERVER_ERROR_NOT_IMPLEMENTED;
                break;
            case 502:
                result = SERVER_ERROR_BAD_GATEWAY;
                break;
            case 503:
                result = SERVER_ERROR_SERVICE_UNAVAILABLE;
                break;
            case 504:
                result = SERVER_ERROR_GATEWAY_TIMEOUT;
                break;
            case 505:
                result = SERVER_ERROR_VERSION_NOT_SUPPORTED;
                break;
            case 507:
                result = SERVER_ERROR_INSUFFICIENT_STORAGE;
                break;

            case 1000:
                result = CONNECTOR_ERROR_CONNECTION;
                break;
            case 1001:
                result = CONNECTOR_ERROR_COMMUNICATION;
                break;
            case 1002:
                result = CONNECTOR_ERROR_INTERNAL;
                break;
        }

        return result;
    }
10979
public IStatus createStatus(int severity, int code, Throwable cause) {
		return createStatus(severity, code, null, cause);
	}
1242525
public static Region getInstance(int code) {

        loadRegionData();

        Region r = numericCodeMap.get(code);

        if ( r == null ) { // Just in case there's an alias that's numeric, try to find it.
            String pad = "";
            if ( code < 10 ) {
                pad = "00";
            } else if ( code < 100 ) {
                pad = "0";
            }
            String id = pad + Integer.toString(code);
            r = regionAliases.get(id);
        }

        if ( r == null ) {
            throw new IllegalArgumentException("Unknown region code: " + code);
        }

        if ( r.type == RegionType.DEPRECATED && r.preferredValues.size() == 1) {
            r = r.preferredValues.get(0);
        }

        return r;
    }
83039
private static int codeToUnary(final int code) {
    final int result;

    switch (code) {
      case CODE_MINUS:
        result = CODE_UNARYMINUS;
        break;
      case CODE_ADD:
        result = CODE_UNARYPLUS;
        break;
      default:
        result = code;
        break;
    }
    return result;
  }
446270
@Override
    public void setStatus(int code, String reason) {
        this.response.setStatus(code);
        this.response.setReason(reason);
    }
193458
public OauthGetTokenResponse getToken(String code) {
        BeanUtil.requireNonNull(code, "code is null");
        OauthGetTokenResponse response = null;
        String url = BASE_API_URL + "sns/oauth2/access_token?appid=" + this.config.getAppid() + "&secret=" + this.config.getSecret() + "&code=" + code + "&grant_type=authorization_code";
        BaseResponse r = executeGet(url);
        String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
        response = JSONUtil.toBean(resultJson, OauthGetTokenResponse.class);
        return response;
    }
840254
public HttpMessage status(final HttpStatus statusCode) {
        statusCode(statusCode.value());
        reasonPhrase(statusCode.name());
        return this;
    }
108038
public static Predicate<? super Throwable> statusCode(int... codes) {
        return t -> t instanceof ClientV2Exception &&
            Arrays.stream(codes).anyMatch(candidate -> ((ClientV2Exception) t).getCode().equals(candidate));
    }
303106
public final function withStatus(
       $code,
       $reasonPhrase = ""): ResponseInterface
   {
       try {
           $response = $this->with("statusCode", $code);
           $response->setStatus((int) $code, $reasonPhrase);
       } catch (InvalidArgumentException $e) {
           throw new InvalidArgumentException(
               "Can't get instance for status: " . $e->getMessage());
       }
       return $response;
   }
264550
def add_status_code(code):
    
    def class_decorator(cls):
        """内部装饰函数,用于将异常类注册到对应的状态码.

        Parameters:
            cls (Callable): - 要注册的异常类
        Return:
            (Callable): - 注册的异常类

        """
        cls.status_code = code
        _mprpc_exceptions[code] = cls
        return cls

    return class_decorator
76091
public boolean isTemporaryStatusCode() {
        int code = this.myStatusCode.getIntCode();
        //We need to check if the WebContainer spec level is greater than 3.0
        //If it is then we don't want to treat the 101 status code as a temp
        //one as it changes our behavior
        if (HttpDispatcher.useEE7Streams() && (code == 101))
            return false;
        return (100 <= code && 200 > code);
    }
771432
def add_status_code(code):
    

    def class_decorator(cls):
        cls.status_code = code
        _sanic_exceptions[code] = cls
        return cls

    return class_decorator
506277
public function getResponse(int $code): Response
    {
        if (!isset($this->responses[$code])) {
            if (isset($this->responses[0])) {
                // Return default response
                return $this->responses[0];
            }
            throw new \InvalidArgumentException(
                "Operation '{$this->getId()}' does not have a definition for status '$code'" .
                " (has " . implode(', ', array_keys($this->responses)) . ')'
            );
        }

        return $this->responses[$code];
    }
932644
public function status( $code = null ) 
	{
		if ( !is_null( $code ) ) 
		{
			if ( headers_sent() && !CLI ) 
			{
				throw new CCException( "CCResponse::status - cannot change status header has already been send." );
			}

			$this->_status = $code; return $this;
		}

		return $this->_status;
	}
649795
public int statusCode() {
        ByteBuf binaryData = content();
        if (binaryData == null || binaryData.capacity() == 0) {
            return -1;
        }

        binaryData.readerIndex(0);
        int statusCode = binaryData.readShort();
        binaryData.readerIndex(0);

        return statusCode;
    }
638457
public static Status fromCodeValue(int codeValue) {
    if (codeValue < 0 || codeValue > STATUS_LIST.size()) {
      return UNKNOWN.withDescription("Unknown code " + codeValue);
    } else {
      return STATUS_LIST.get(codeValue);
    }
  }
1360841
PollingState<T> withStatus(String status, int statusCode) throws IllegalArgumentException {
        if (status == null) {
            throw new IllegalArgumentException("Status is null.");
        }
        this.status = status;
        this.statusCode = statusCode;
        return this;
    }