In the company code, with a lot of enumeration, I am very confused to see. Let's start by looking at how enumerations are written and how to use them. First, the enumeration of the wording of the enumeration, online a lot of this knowledge. Here is a code for the enumeration class that I write myself directly.
package com.tomtop.application.libraries.constentEnum;
/**
* 包材领用状态枚举类
* @author zeng.xiao.yan
* @date Jun 5, 2017 1:04:40 PM
* @version V1.0
*/
public enum UseStatusEnum {
PACKING_NOT_USE(1), // 未领用
PACKING_HAS_USED(2), // 已领用
PACKING_BACK_USE(3); // 已打回
private Integer useStatus;
private UseStatusEnum(int useStatus) {
this.useStatus = useStatus;
}
public Integer getUseStatus() {
return useStatus;
}
}
Ii. usage of enumeration classes in code
productPackingRecord.setUseStatus(UseStatusEnum.PACKING_NOT_USE.getUseStatus()); //设为未领用状态
Note: This method is called Getusestatus to return the value of the enumeration constant.
Reference Link: http://blog.csdn.net/u014527058/article/details/52751488 http://blog.csdn.net/qiyueqing lian/article/details/50738548
To be continued ...
Syntax and usage of enumerations in Java