All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.chanjx.utils.HttpMethod Maven / Gradle / Ivy

The newest version!
package com.chanjx.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 陈俊雄
 * @since 2020/11/12
 **/
public enum HttpMethod {

    GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;

    private static final Map mappings = new HashMap<>(8);

    static {
        for (HttpMethod httpMethod : values()) {
            mappings.put(httpMethod.name(), httpMethod);
        }
    }

    public static HttpMethod resolve(String method) {
        return (method != null ? mappings.get(method) : null);
    }

    public boolean matches(String method) {
        return (this == resolve(method));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy