枚举例子
来源:互联网 发布:java实现员工管理系统 编辑:程序博客网 时间:2024/05/19 18:44
public enum PCOptionStatusEnum {
WAITTING_HANDLING("0", "待处理"), HANDLE_SUCCESS("1", "处理成功"), HANDLE_FAILUER("2", "处理失败"), HANDLE_CANCEL("3",
"作废"), HANDLING("4", "处理中");
private final String key;
private final String value;
PCOptionStatusEnum(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
public static Map<String, String> getList() {
Map<String, String> map = new HashMap<String, String>();
for (PCOptionStatusEnum w : PCOptionStatusEnum.values()) {
map.put(w.getKey(), w.getValue());
}
return map;
}
public class StatusEnum implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6806619642573481280L;
/**
* 订单来源类型
*
* @author zhaowei
* 2011-12-16 add
*
*/
public enum OrderTypeEnum {
TB_ORDER("B", "宝"), ZF_ORDER("F", "发"), CFT_ORDER("FT", "付通");
private OrderTypeEnum(String key, String value) {
this.key = key;
this.value = value;
}
private final String key;
private final String value;
public String getKey() {
return key;
}
public String getValue() {
return value;
}
/**
* 获取订单状态
*
* @return
*/
public static Map<String, String> getOrderTypeList() {
Map<String, String> status = new HashMap<String, String>();
status.put("TB", "宝");
status.put("ZF", "发");
status.put("CFT", "通");
return status;
}
public static String getReviewStatus(String key) {
for (OrderStatusEnum status : OrderStatusEnum.values()) {
if (status.getKey().equals(key)) {
return status.getValue();
}
}
return "";
}
}
/**
*
* @author zhangf
*
*/
public enum DrawBillStatusEnum {
NOT_CHECKED(0, "未"), CHECKED_ING(1, "中"), CHECKED_SUCCESS(2, "通过"), CHECKED_FAIL(3, "通过"), DRAW_FINISHED(
4, "已"), DRAW_SUCCESS(5, "成功"), DRAW_FAIL(6, "失败"), DRAW_CANCEL(7,"撤");
private DrawBillStatusEnum(int key, String value) {
this.key = key;
this.value = value;
}
private final int key;
private final String value;
public int getKey() {
return key;
}
public String getValue() {
return value;
}
/**
* 根据第一个参数查找第二个参数的值
*
* @param p1
* @return
*/
public static String getP2ByP1(int param1) {
for (DrawBillStatusEnum w : DrawBillStatusEnum.values()) {
if (param1 == w.getKey()) {
return w.getValue();
}
}
return "";
}
/**
* 将枚举的值的参数以 key:value的形式存入map
*
* @return
*/
public static Map<String, String> getElemMap() {
Map<String, String> map = new LinkedHashMap<String, String>();
for (DrawBillStatusEnum w : DrawBillStatusEnum.values()) {
map.put(String.valueOf(w.getKey()), w.getValue());
}
return map;
}
}
}
WAITTING_HANDLING("0", "待处理"), HANDLE_SUCCESS("1", "处理成功"), HANDLE_FAILUER("2", "处理失败"), HANDLE_CANCEL("3",
"作废"), HANDLING("4", "处理中");
private final String key;
private final String value;
PCOptionStatusEnum(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
public static Map<String, String> getList() {
Map<String, String> map = new HashMap<String, String>();
for (PCOptionStatusEnum w : PCOptionStatusEnum.values()) {
map.put(w.getKey(), w.getValue());
}
return map;
}
public class StatusEnum implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6806619642573481280L;
/**
* 订单来源类型
*
* @author zhaowei
* 2011-12-16 add
*
*/
public enum OrderTypeEnum {
TB_ORDER("B", "宝"), ZF_ORDER("F", "发"), CFT_ORDER("FT", "付通");
private OrderTypeEnum(String key, String value) {
this.key = key;
this.value = value;
}
private final String key;
private final String value;
public String getKey() {
return key;
}
public String getValue() {
return value;
}
/**
* 获取订单状态
*
* @return
*/
public static Map<String, String> getOrderTypeList() {
Map<String, String> status = new HashMap<String, String>();
status.put("TB", "宝");
status.put("ZF", "发");
status.put("CFT", "通");
return status;
}
public static String getReviewStatus(String key) {
for (OrderStatusEnum status : OrderStatusEnum.values()) {
if (status.getKey().equals(key)) {
return status.getValue();
}
}
return "";
}
}
/**
*
* @author zhangf
*
*/
public enum DrawBillStatusEnum {
NOT_CHECKED(0, "未"), CHECKED_ING(1, "中"), CHECKED_SUCCESS(2, "通过"), CHECKED_FAIL(3, "通过"), DRAW_FINISHED(
4, "已"), DRAW_SUCCESS(5, "成功"), DRAW_FAIL(6, "失败"), DRAW_CANCEL(7,"撤");
private DrawBillStatusEnum(int key, String value) {
this.key = key;
this.value = value;
}
private final int key;
private final String value;
public int getKey() {
return key;
}
public String getValue() {
return value;
}
/**
* 根据第一个参数查找第二个参数的值
*
* @param p1
* @return
*/
public static String getP2ByP1(int param1) {
for (DrawBillStatusEnum w : DrawBillStatusEnum.values()) {
if (param1 == w.getKey()) {
return w.getValue();
}
}
return "";
}
/**
* 将枚举的值的参数以 key:value的形式存入map
*
* @return
*/
public static Map<String, String> getElemMap() {
Map<String, String> map = new LinkedHashMap<String, String>();
for (DrawBillStatusEnum w : DrawBillStatusEnum.values()) {
map.put(String.valueOf(w.getKey()), w.getValue());
}
return map;
}
}
}
- 枚举例子
- 枚举的例子
- 枚举使用小例子
- 一个枚举的例子
- 枚举类型例子
- 枚举小例子
- 枚举类型简单例子
- 枚举简单例子
- 枚举类型小例子
- 枚举类例子
- 一个枚举目录的例子
- 枚举值转换的例子
- 枚举类的使用例子
- 算法例子-枚举算法1.4
- Java枚举类-应用例子
- 枚举类的用法例子
- Java enum枚举 测试例子
- 一个枚举的简单例子
- jxt Excel 导入数据
- Domino 服务器日常管理常用命令
- 不能执行已释放 Script 的代码解块方案
- 刷新物化视图和查看子类四级分类
- java程序在执行过程中,类,对象以及它们成员加载、初始化的顺序如下:
- 枚举例子
- [转]session详解
- 基于Struts2、Freemarker的分页组件实现(附工程源码)
- Java SSH远程执行Shell脚本实现(转)
- Quartz+Spring 自定义作业调度(作业在DB中配置) (转)
- 统计一个目录下的图片信息
- java 基础性能'
- 大O表示法
- 如何在razer中调用方法