From 3c4fee1db116c11d4f04727cfe076d7c94daeaf2 Mon Sep 17 00:00:00 2001
From: yanzhaofeige <yanzhaofeige@qq.com>
Date: Mon, 30 Sep 2024 12:10:57 +0800
Subject: [PATCH] init

---
 cpzidc-common/src/main/java/com/odcc/cpzidc/common/enums/HttpMethod.java |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/cpzidc-common/src/main/java/com/odcc/cpzidc/common/enums/HttpMethod.java b/cpzidc-common/src/main/java/com/odcc/cpzidc/common/enums/HttpMethod.java
new file mode 100644
index 0000000..08679d6
--- /dev/null
+++ b/cpzidc-common/src/main/java/com/odcc/cpzidc/common/enums/HttpMethod.java
@@ -0,0 +1,36 @@
+package com.odcc.cpzidc.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.springframework.lang.Nullable;
+
+/**
+ * 请求方式
+ *
+ * @author ruoyi
+ */
+public enum HttpMethod
+{
+    GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
+
+    private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
+
+    static
+    {
+        for (HttpMethod httpMethod : values())
+        {
+            mappings.put(httpMethod.name(), httpMethod);
+        }
+    }
+
+    @Nullable
+    public static HttpMethod resolve(@Nullable String method)
+    {
+        return (method != null ? mappings.get(method) : null);
+    }
+
+    public boolean matches(String method)
+    {
+        return (this == resolve(method));
+    }
+}

--
Gitblit v1.9.3