HttpMethodEnum.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */
  20. package org.openspcoop2.core.config.rs.server.model;

  21. import com.fasterxml.jackson.annotation.JsonCreator;
  22. import com.fasterxml.jackson.annotation.JsonValue;

  23. /**
  24.  * Gets or Sets HttpMethodEnum
  25.  */
  26. public enum HttpMethodEnum {
  27. QUALSIASI("Qualsiasi"),
  28.   GET("GET"),
  29.   POST("POST"),
  30.   PUT("PUT"),
  31.   DELETE("DELETE"),
  32.   OPTIONS("OPTIONS"),
  33.   HEAD("HEAD"),
  34.   TRACE("TRACE"),
  35.   PATCH("PATCH"),
  36.   LINK("LINK"),
  37.   UNLINK("UNLINK");

  38.   private String value;

  39.   HttpMethodEnum(String value) {
  40.     this.value = value;
  41.   }

  42.   @Override
  43.   @JsonValue
  44.   public String toString() {
  45.     return String.valueOf(this.value);
  46.   }

  47.   @JsonCreator
  48.   public static HttpMethodEnum fromValue(String text) {
  49.     for (HttpMethodEnum b : HttpMethodEnum.values()) {
  50.       if (String.valueOf(b.value).equals(text)) {
  51.         return b;
  52.       }
  53.     }
  54.     return null;
  55.   }
  56.  
  57. }