jinlin
2024-02-23 1772fc5e211f9e9e0ab4cdc6c29b436aac178c2a
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
package com.zt.common.message.model;
 
public enum MessageType {
 
    INNER("inner", "内部消息"),
    EMAIL("email", "邮件"),
    SMS("sms", "短信");
 
    private String key = "";
    private String title = "";
 
    private MessageType(String key, String title) {
        this.key = key;
        this.title = title;
    }
 
    public String getKey() {
        return this.key;
    }
 
    public void setKey(String key) {
        this.key = key;
    }
 
    public String getTitle() {
        return this.title;
    }
 
    public void setTitle(String title) {
        this.title = title;
    }
 
    public String toString() {
        return this.key;
    }
 
    public static MessageType fromKey(String key) {
        for (MessageType c : MessageType.values()) {
            if (c.getKey().equalsIgnoreCase(key)) {
                return c;
            }
        }
        throw new IllegalArgumentException(key);
    }
}