判断值是否在枚举类的值中
判断值是否在枚举类中
@Getter
public enum PictureTypeEnum {
HEAD_PORTRAIT(1, "头像"),
ID_CARD_NO(2,"身份证");
PictureTypeEnum(Integer value, String message) {
this.value = value;
this.message = message;
}
public static boolean isValidEnum(Integer value) {
return Arrays.stream(PictureTypeEnum.values()).anyMatch(o -> Objects.equals(o.getValue(), value));
}
private Integer value;
private String message;
}
判断值是否在枚举类的值中
https://shikai.info/archives/1697018744314