elkers
2025-04-07 bd9808a81b1eafdc75a42c1c9904408dc888061d
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
54
55
56
57
58
59
60
61
62
63
64
package com.nanjing.water.common.enums;
 
import java.util.Arrays;
 
/**
 * 垂直位置 枚举
 */
public enum EVerticalLocation {
    /**
     * 靠顶端
     */
    TOP("TOP", 1),
 
    /**
     * 居中
     */
    MIDDLE("MIDDLE", 2),
 
    /**
     * 靠底部
     */
    BOTTOM("BOTTOM", 3);
 
    private String desc;//枚举描述
    private int value;//枚举值
 
    public int getValue() {
        return value;
    }
    public String getDesc() {
        return desc;
    }
 
    /**
     * 构造方法
     * @param desc 枚举描述
     * @param value 枚举值
     */
    EVerticalLocation(String desc, int value) {
        this.desc = desc;
        this.value = value;
    }
 
    /**
     * 根据值获取枚举
     *
     * @param value 枚举值
     * @return
     */
    public static EVerticalLocation getByValue(int value) {
        return Arrays.stream(EVerticalLocation.values())
                .filter(e -> e.getValue() == value)
                .findFirst()
                .orElse(null);
    }
 
    @Override
    public String toString() {
        return "EVerticalLocation{" +
                "desc='" + desc + '\'' +
                ", value=" + value +
                '}';
    }
}