DefeatTypeEnum.java
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package cn.fw.valhalla.common.enums;
import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;
/**
* @author : kurisu
* @className : DefeatTypeEnum
* @description : 战败类型
* @date: 2020-10-16 17:56
*/
public enum DefeatTypeEnum {
/**
* 主动战败
*/
A(1, "主动战败"),
/**
* 到期划走
*/
B(2, "到期划走"),
/**
* 到期战败
*/
C(3, "到期战败");
/**
* 值
*/
private final Integer value;
/**
* 名称
*/
@Getter
private final String name;
DefeatTypeEnum(final Integer value, final String name) {
this.value = value;
this.name = name;
}
/**
* 根据枚举值获取枚举对象
*/
@JsonCreator
public static DefeatTypeEnum ofValue(final Integer value) {
for (final DefeatTypeEnum typeEnum : DefeatTypeEnum.values()) {
if (typeEnum.value.equals(value)) {
return typeEnum;
}
}
return null;
}
}