中国算力平台算力登记系统2.0
yanzhaofeige
2024-09-30 3c4fee1db116c11d4f04727cfe076d7c94daeaf2
commit | author | age
43dc29 1 package com.odcc.cpzidc.common.enums;
Y 2
3 import java.util.HashMap;
4 import java.util.Map;
5 import org.springframework.lang.Nullable;
6
7 /**
8  * 请求方式
9  *
10  * @author ruoyi
11  */
12 public enum HttpMethod
13 {
14     GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
15
16     private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
17
18     static
19     {
20         for (HttpMethod httpMethod : values())
21         {
22             mappings.put(httpMethod.name(), httpMethod);
23         }
24     }
25
26     @Nullable
27     public static HttpMethod resolve(@Nullable String method)
28     {
29         return (method != null ? mappings.get(method) : null);
30     }
31
32     public boolean matches(String method)
33     {
34         return (this == resolve(method));
35     }
36 }