import java.util.Arrays;
/**
* @author yangquan
* @since 2023-10-05
*/
public enum AuthenticationStatusEnum {
ALREADY_AUTHENTICATION("ALREADY_AUTHENTICATION", "已认证"),
NO_AUTHENTICATION("NO_AUTHENTICATION", "未认证"),
;
private String status;
private String desc;
/**
* 构造函数
*
* @param status
* @param desc
*/
AuthenticationStatusEnum(String status, String desc) {
this.status = status;
this.desc = desc;
}
public static String getDesc(String status) {
return Arrays.stream(values())
.filter(a -> a.getStatus().equals(status))
.findFirst()
.map(AuthenticationStatusEnum::getDesc)
.orElse(null);
}
public static AuthenticationStatusEnum getByStatus(String status) {
return Arrays.stream(values())
.filter(a -> a.getStatus().equals(status))
.findFirst()
.orElse(null);
}
public String getStatus() {
return status;
}
public String getDesc() {
return desc;
}
}
import java.util.Arrays;
/**
* 描述:
* 商家卡片类型
*
* @author yangquan
* @date 2023-09-25
*/
public enum MerchantCardTypeEnum {
UNION("UNION", "联名卡片","有宠有家联名卡"),
;
private String status;
private String desc;
private String userShowDesc;
MerchantCardTypeEnum() {
}
/**
* 构造函数
*
* @param status
* @param desc
*/
MerchantCardTypeEnum(String status, String desc , String userShowDesc) {
this.status = status;
this.desc = desc;
this.userShowDesc = userShowDesc;
}
// 获取描述
public static String getDescWithGender(String status) {
return Arrays.stream(values())
.filter(s -> s.getStatus().equals(status))
.findFirst()
.map(MerchantCardTypeEnum::getDesc)
.orElse(null);
}
// 获取用户端展示描述
public static String getUserShowDescBySatus(String status) {
return Arrays.stream(values())
.filter(s -> s.getStatus().equals(status))
.findFirst()
.map(MerchantCardTypeEnum::getUserShowDesc)
.orElse(null);
}
public String getStatus() {
return status;
}
public String getDesc() {
return desc;
}
public String getUserShowDesc() {
return userShowDesc;
}
}
这辈子坚持与不坚持都不可怕,怕的是独自走在坚持的道路上!