public enum RequestType extends Enum<RequestType>
文件名:RequestType.java
用途: 定义接口请求的方式
编码时间:2020年6月17日下午7:50:54
修改时间:2022年4月19日 下午4:10:48
Enum Constant and Description |
---|
CONNECT
CONNECT请求
|
COPY
COPY请求
|
DELETE
DELETE请求
|
GET
GET请求
|
HEAD
HEAD请求
|
LINK
LINK请求
|
LOCK
LOCK请求
|
MKCOL
MKCOL请求
|
MOVE
MOVE请求
|
OPTIONS
OPTIONS请求
|
PATCH
请求
|
POST
POST请求
|
PROPFIND
PROPFIND请求
|
PURGE
PURGE请求
|
PUT
PUT请求
|
TRACE
TRACE请求
|
UNLINK
UNLINK请求
|
UNLOCK
UNLOCK请求
|
VIEW
VIEW请求
|
Modifier and Type | Method and Description |
---|---|
static RequestType |
typeText2Type(String type)
该方法用于将枚举文本转换为消息枚举
|
static RequestType |
typeText2Type(String type,
Function<String,String> mapper)
该方法用于将枚举文本转换为消息枚举
|
static RequestType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static RequestType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final RequestType GET
public static final RequestType POST
public static final RequestType PUT
public static final RequestType DELETE
public static final RequestType OPTIONS
public static final RequestType HEAD
public static final RequestType PATCH
public static final RequestType TRACE
public static final RequestType CONNECT
public static final RequestType COPY
public static final RequestType LINK
public static final RequestType UNLINK
public static final RequestType PURGE
public static final RequestType LOCK
public static final RequestType UNLOCK
public static final RequestType MKCOL
public static final RequestType MOVE
public static final RequestType PROPFIND
public static final RequestType VIEW
public static RequestType[] values()
for (RequestType c : RequestType.values()) System.out.println(c);
public static RequestType valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static RequestType typeText2Type(String type)
该方法本质上与valueOf(String)
方法的作用一致,但其中加上了对文本的内容的判空、对文本内容大写转换、
对特殊文本进行处理以及对异常文本进行汉化的操作。
type
- 枚举文本内容IllegalArgumentException
- 当枚举文本为空或不能转换成枚举时抛出的异常public static RequestType typeText2Type(String type, Function<String,String> mapper)
该方法与typeText2Type(String)
方法类似,其可对传入的文本进行自定义的转换,例如欲将传入的"po"转换为"post",则可写为
RequestType.typeText2MessageType("po", type -> {
if ("po".equals(text)) {
text = "post";
}
return text;
});
type
- 枚举文本内容mapper
- 枚举文本的处理方法IllegalArgumentException
- 当枚举文本为空或不能转换成枚举时抛出的异常Copyright © 2024. All rights reserved.