当前位置:网站首页>关于枚举类的两种用法
关于枚举类的两种用法
2022-06-27 11:55:00 【瑾琳】
/** * */ package com.***.enums; /** * 根据发票代码查找发票所属省份 * * @author jinyulinlang date:2018年7月26日 */ public enum CityEnum { BJS("北京市", "11"), SHHS("上海市", "31"), TJS("天津市", "12"), CHQS("重庆市", "50"), XGTBXZQ("香港特别行政区", "xg"), AMTBXZQ( "澳门特别行政区", "am"), HEBS("河北省", "13"), ZJS("浙江省", "33"), LNS("辽宁省", "21"), HUBS("湖北省", "42"), JSS("江苏省", "32"), NMGZZQ("内蒙古自治区", "15"), JXS("江西省", "36"), SXS("山西省", "14"), GSS("甘肃省", "62"), SDS("山东省", "37"), HLJS("黑龙江省", "23"), FJS("福建省", "35"), GDS("广东省", "44"), SCS("四川省", "52"), HUNS("湖南省", "43"), HENS("河南省", "41"), YNS("云南省", "53"), AHS("安徽省", "34"), NXZZQ("宁夏回族自治区", "64"), JLS("吉林省", "22"), GXZZQ("广西壮族自治区", "45"), GZS("贵州省", "52"), SHXS("陕西省", "61"), QHS("青海省", "63"), HINS("海南省", "46"), XZ("西藏自治区", "54"), XJZZQ("新疆维吾尔自治区", "65"); private String name; private String index; /** * 构造器 * * @param name * @param index */ private CityEnum(String name, String index) { this.name = name; this.index = index; } public static String getName(String index) { for (CityEnum city : CityEnum.values()) { if (city.index.equals(index)) { return city.name; } } return "本系统暂不支持港澳台发票相关业务!"; } /** * 测试 * * @param args */ public static void main(String[] args) { String name2 = getName("41"); System.out.println(name2); } } /** * */ package com.*****.test; import com.sun.glass.ui.TouchInputSupport; /** * @Title: TestEnum.java * @author jinyulinlang * @date 2018年9月27日 * @version V1.0 */ public enum TestEnum { NONE("NoPadding"), ISO10126("ISO10126Padding"), OAEP("OAEPPadding"), OAEPWithMd5AndMgf1( "OAEPWithMD5AndMGF1Padding"), OAEPWithSha1AndMgf1("OAEPWithSHA-1AndMGF1Padding"), OAEPWithSha256AndMgf1( "OAEPWithSHA-256AndMGF1Padding"), OAEPWithSha384AndMgf1( "OAEPWithSHA-384AndMGF1Padding"), OAEPWithSha512AndMgf1( "OAEPWithSHA-512AndMGF1Padding"), PKCS1( "PKCS1Padding"), PKCS5("PKCS5Padding"), SSL3("SSL3Padding"); private String name; private TestEnum(String name) { this.name = name; } public String getname() { return this.name; } public static TestEnum getName(String name) { for (TestEnum testEnum : TestEnum.values()) { if (testEnum.name.equals(name)) { return testEnum; } } return null; } public static void main(String[] args) { TestEnum name2 = getName("OAEPPadding"); System.out.println(name2); } }
边栏推荐
- 在 Golang 中构建 CRUD 应用程序
- .NET6接入Skywalking链路追踪完整流程
- 器审科普:创新医疗器械系列科普——胸骨板产品
- PyQt,PySide-槽函数被执行了两次
- The R language uses the follow up The plot function visualizes the longitudinal follow-up map of multiple ID (case) monitoring indicators, and uses stress The labels parameter adds label information t
- C # WPF realizes undo redo function
- 如何修改 node_modules 里的文件
- Unity shader learning (II) the first shader
- 内存四区(栈,堆,全局,代码区)
- Youboxun attended the openharmony technology day to create a new generation of secure payment terminals
猜你喜欢

AUTOCAD——三种修剪方式
![[tcapulusdb knowledge base] tcapulusdb doc acceptance - transaction execution introduction](/img/d9/f6735906a130834c4b3e28de2b2617.png)
[tcapulusdb knowledge base] tcapulusdb doc acceptance - transaction execution introduction

MySQL高阶语句(一)

How to adjust an integer that is entered in Excel but always displays decimals?

一个有趣的网络掩码的实验

MapReduce practical cases (customized sorting, secondary sorting, grouping, zoning)

Detailed explanation of interprocess communication

pull request

Drive to APasS! Use Mingdao cloud to manage F1 events
![[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction](/img/a4/c3255ce17516348f703f7f21511555.png)
[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction
随机推荐
Mit6.031 software construction7 reading notesdesigning specifications
Histrix工作原理
Jianmu continuous integration platform v2.5.0 release
Redis distributed lock 15 ask, what have you mastered?
JSP自定义标签
Heap heap sort TOPK
pull request
AUTOCAD——三种修剪方式
I.MX6ULL启动方式
Mathematical knowledge -- ideas and examples of game theory (bash game, Nim game, wizov game)
最短编辑距离(线性dp写法)
手把手带你入门 API 开发
[tcapulusdb knowledge base] tcapulusdb system user group introduction
建木持续集成平台v2.5.0发布
alibaba jarslink
Excel中输入整数却总是显示小数,如何调整?
想学好C语言,操作符也很重要
解压 .log.gz 文件
优博讯出席OpenHarmony技术日,全新打造下一代安全支付终端
Unity Shader学习(二)第一个Shader