You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package com.inscloudtech.common.enums;
import org.springframework.lang.Nullable;
import java.util.HashMap; import java.util.Map;
/** * 请求方式 * * @author inscloudtech */ 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)); } }
|