public enum LoanTypeEnum {
LOAN_CAR(0, "车贷"),
LOAN_PERSONAL(1, "个人贷"),
LOAN_BUSINESS(2, "商业贷"),
;
private Integer code;
private String message;
LoanTypeEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
//int到enum的转换函数
public static LoanTypeEnum valueOf(int value) {
switch (value) {
case 0:
return LoanTypeEnum.LOAN_CAR;
case 1:
return LoanTypeEnum.LOAN_PERSONAL;
case 2:
return LoanTypeEnum.LOAN_BUSINESS;
default:
return null;
}
}
}