package com.qianwen.smartman.modules.mdc.enums; import java.util.stream.Stream; /** * 反馈状态 */ public enum FeedbackStatus { WAIT_SYNC("待执行", 1), SYNCING("执行中", 2), SYNCED("执行完成", 3); private final String name; private final Integer value; FeedbackStatus(String name, int value) { this.name = name; this.value = Integer.valueOf(value); } public Integer getValue() { return this.value; } public String getName() { return this.name; } public FeedbackStatus of(final Integer value) { if (value == null) { return null; } return Stream.of(values()).filter(item -> (item.getValue().intValue() == value.intValue())).findFirst().orElse(null); /* return (FeedbackStatus) Stream.of((Object[]) values()).filter(item -> { return item.getValue().intValue() == value.intValue(); }).findFirst().orElse(null);*/ } }