当前位置:网站首页>(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 !
边栏推荐
- Skill review of test engineer before interview
- 华为HCIP-DATACOM-Core_03day
- C语言指针(下篇)
- 【ChaosBlade:节点磁盘填充、杀节点上指定进程、挂起节点上指定进程】
- STM32的时钟系统
- Troublesome problem of image resizing when using typora to edit markdown to upload CSDN
- H3C vxlan configuration
- How to use Arthas to view class variable values
- JVM garbage collection detailed learning notes (II)
- Do you have any certificates with high gold content?
猜你喜欢

端口复用和重映像

Detailed learning notes of JVM memory structure (I)

Zen - batch import test cases

Connecting mobile phone with ADB

NVIC interrupt priority management

NVIC中断优先级管理

Port multiplexing and re imaging

Jenkins modifies the system time

STM32 serial port register library function configuration method

正则匹配以XXX开头的,XXX结束的
随机推荐
(3/8)枚举的不当用法 之 方法参数(二)
Port multiplexing and re imaging
Pytest installation (command line installation)
【ChaosBlade:节点磁盘填充、杀节点上指定进程、挂起节点上指定进程】
【Istio Network CRD VirtualService、Envoyfilter】
C language pointer (special article)
When inputting an expression in the input box, an error is reported: incorrect string value:'\xf0\x9f... ' for column 'XXX' at row 1
Variable parameter of variable length function
PMP certificate preparation experience sharing
What is the use of PMP certificate?
Leetcode question brushing record (array) combination sum, combination sum II
Synchronized underlying principle, volatile keyword analysis
JVM 垃圾回收 详细学习笔记(二)
Simulation volume leetcode [general] 1557 The minimum number of points that can reach all points
2020 year end summary
Skill review of test engineer before interview
外部中断实现按键实验
Pytest+request+allure+excel interface automatic construction from 0 to 1 [familiar with framework structure]
Expérience de port série - simple réception et réception de données
5A summary: seven stages of PMP learning