yuan
5 天以前 15f7555b9f9d3e3ae2cdaa82d89bc7ea5160f62c
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
package com.ruoyi.basic.enums;
 
import lombok.Getter;
 
@Getter
public enum ApplicationTypeEnum {
    IMAGE("image"),
    FILE("file"),
    AFTER_FILE("after_file"),
    BEFORE_FILE("before_file"),
    APK("apk");
 
 
    private final String type;
    ApplicationTypeEnum(String type) { this.type = type; }
 
    /**
     * 根据 type 值获取对应的枚举实例
     * @param type 应用类型字符串
     * @return 对应的 ApplicationTypeEnum 枚举实例
     * @throws RuntimeException 如果 type 无效
     */
    public static ApplicationTypeEnum getByType(String type) {
        for (ApplicationTypeEnum enumValue : ApplicationTypeEnum.values()) {
            if (enumValue.getType().equals(type)) {
                return enumValue;
            }
        }
        throw new RuntimeException("无效的应用类型: " + type);
    }
}