AllocationTypeEnum.java
1013 Bytes
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
package cn.fw.valhalla.common.enums;
import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;
/**
* @author : kurisu
* @className : AllocationTypeEnum
* @description : 分配方式
* @date: 2020-10-16 17:56
*/
public enum AllocationTypeEnum {
/**
* 指定人员
*/
ONE(1, "指定人员"),
/**
* 平均分配
*/
ALL(2, "平均分配");
/**
* 值
*/
private final Integer value;
/**
* 名称
*/
@Getter
private final String name;
AllocationTypeEnum(final Integer value, final String name) {
this.value = value;
this.name = name;
}
/**
* 根据枚举值获取枚举对象
*/
@JsonCreator
public static AllocationTypeEnum ofValue(final Integer value) {
for (final AllocationTypeEnum typeEnum : AllocationTypeEnum.values()) {
if (typeEnum.value.equals(value)) {
return typeEnum;
}
}
return null;
}
}