当前位置:网站首页>(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 !
边栏推荐
- 2022-06-30 unity core 8 - model import
- When inputting an expression in the input box, an error is reported: incorrect string value:'\xf0\x9f... ' for column 'XXX' at row 1
- Ppt template and material download website (pure dry goods, recommended Collection)
- Data association between two interfaces of postman
- Leetcode刷题记录(数组)组合总和、组合总和 II
- Error: selenium common. exceptions. WebDriverException: Messag‘geckodriver‘ execute
- Analysis of Hessian serialization principle
- 【Istio Network CRD VirtualService、Envoyfilter】
- Simulation volume leetcode [general] 1567 Length of the longest subarray whose product is a positive number
- PMP certificate preparation experience sharing
猜你喜欢

C语言指针(特别篇)

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

What are the conditions for applying for NPDP?

What is the use of PMP certificate?

Expérience de port série - simple réception et réception de données

Synchronized underlying principle, volatile keyword analysis

Locust performance test 4 (custom load Policy)

C language pointer (Part 2)

How to use Arthas to view class variable values

MySql数据库-事务-学习笔记
随机推荐
Personal deduction topic classification record
DRF authentication, permissions, and flow restrictions (only for views in DRF)
Jenkins+ant+jmeter use
Troublesome problem of image resizing when using typora to edit markdown to upload CSDN
2022-06-30 unity core 8 - model import
Error: selenium common. exceptions. WebDriverException: Messag‘geckodriver‘ execute
【SVN】SVN是什么?怎么使用?
JVM 内存结构 详细学习笔记(一)
OpenGL frame buffer
LeetCode每日一题(2316. Count Unreachable Pairs of Nodes in an Undirected Graph)
Simulation volume leetcode [general] 1567 Length of the longest subarray whose product is a positive number
Data association between two interfaces of postman
答案在哪里?action config/Interceptor/class/servlet
JWT certification used in DRF
Do you have any certificates with high gold content?
Jemter operation
PMP examination experience sharing
华为HCIP-DATACOM-Core_03day
Jenkins modifies the system time
【Istio Network CRD VirtualService、Envoyfilter】