当前位置:网站首页>(3/8) method parameters of improper use of enumeration (2)
(3/8) method parameters of improper use of enumeration (2)
2022-07-07 09:19:00 【51CTO】
Continue to talk about the use of enumeration . This article illustrates the crap of not enumerating method parameters .
【 On the first code 】
First look at the following methods :
The call to this method in the program :
The following is RefundStsEnum Enumeration class :
【 Refactoring mode 】
In the above method String Variable rfdSts, The corresponding enumeration types are defined in the program RefundStsEnum.
This example is a typical example of improper enumeration . The crux is to set method parameters rfdSts Define a String, This leads to two things :
- Inside the method , Like the first line , When logging , First call enumeration RefundStsEnum Of getBySts(), take rfdSts Stored RefundStsEnum Of sts Convert to enumeration RefundStsEnum, then , Get it desc.
- The parameters passed by calling this method are RefundStsEnum.getSts()
The right way to do it is : Put the method parameters rfdSts Defined as an enumeration type RefundStsEnum, natural , There is no such unhappiness . It will be clear !
边栏推荐
- DRF authentication, permissions, and flow restrictions (only for views in DRF)
- Mysql database lock learning notes
- 2022-06-30 unity core 8 - model import
- JWT certification used in DRF
- Connecting mobile phone with ADB
- UnityShader入门精要个人总结--基础篇(一)
- 答案在哪里?action config/Interceptor/class/servlet
- 正则匹配以XXX开头的,XXX结束的
- Unity shader beginner's Essentials (I) -- basic lighting notes
- 硬件大熊原创合集(2022/05更新)
猜你喜欢

Upgrade Alibaba cloud RDS (relational database service) instance to com mysql. jdbc. exceptions. Troubleshooting of jdbc4.communicationsexception

STM32 serial port register library function configuration method

Mysql database transaction learning notes

Storage of data in memory

C语言指针(特别篇)

C语言指针(上篇)

PMP Exam details after the release of the new exam outline

MySQL master-slave delay solution

串口實驗——簡單數據收發

Entity of cesium data visualization (Part 1)
随机推荐
端口复用和重映像
Error: selenium common. exceptions. WebDriverException: Messag‘geckodriver‘ execute
H3C VXLAN配置
Simulation volume leetcode [general] 1609 Parity tree
Locust performance test 2 (interface request)
Jmeters use
Reflections on the way of enterprise IT architecture transformation (Alibaba's China Taiwan strategic thought and architecture practice)
串口实验——简单数据收发
How does the project manager write the weekly summary and weekly plan?
C语言指针(特别篇)
What is the rating of Huishang futures company? Is it safe to open an account? I want to open an account, OK?
Record of structured interview
DRF authentication, permissions, and flow restrictions (only for views in DRF)
Full link voltage test of the e-commerce campaign Guide
JVM 内存结构 详细学习笔记(一)
徽商期货公司评级是多少?开户安全吗?我想开户,可以吗?
Variable parameter of variable length function
Original collection of hardware bear (updated on June 2022)
Pytest installation (command line installation)
ChaosBlade:混沌工程简介(一)