com.chanjx.utils.HttpMethod Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chanjx-utils Show documentation
Show all versions of chanjx-utils Show documentation
A util to improve development efficiency
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));
}
}