xiangpei
2024-06-04 81b6f1cc38a941b65f989ecdd40529f2648bdd8c
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
package com.ycl.jxkg.domain.enums;
 
import java.util.HashMap;
import java.util.Map;
 
public enum VisibilityEnum {
    Private("私有", "只有老师自己能看"),
    Public("公开", "所有人能看");
 
    String name;
    String description;
 
    VisibilityEnum(String name, String description) {
        this.name = name;
        this.description = description;
    }
 
    public String getDescription() {
        return description;
    }
 
    public void setDescription(String description) {
        this.description = description;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
 
    private static final Map<String, VisibilityEnum> keyMap = new HashMap<>();
 
    static {
        for (VisibilityEnum item : VisibilityEnum.values()) {
            keyMap.put(item.getName(), item);
        }
    }
 
    public static VisibilityEnum fromCode(String name) {
        return keyMap.get(name);
    }
 
}