public enum Platform { DOUYIN("DOUYIN", "抖音"), KUAISHOU("KUAISHOU", "快手"); private String code; private String name; Platform(String code, String name) { this.code = code; this.name = name; } public static String getNameByCode(String code) { Platform[] Platforms = values(); for (Platform Platform : Platforms) { if (Platform.getCode().equals(code)) { return Platform.name(); } } return null; } public String getCode() { return code; } public String getName() { return name; } }
来源:CSDN
作者:滑翔路路
链接:https://blog.csdn.net/wanglu0102/article/details/104340488