疯狂的狮子li
2020-03-16 2e6bb454f42a28f719e40abeeeb87e12b4efa93f
ruoyi/src/main/java/com/ruoyi/common/enums/HttpMethod.java
对比新文件
@@ -0,0 +1,36 @@
package com.ruoyi.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));
    }
}