plusone-commons 做了调整。
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package xyz.zhouxy.plusone.constant;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import xyz.zhouxy.plusone.commons.util.Enumeration;
|
||||
|
||||
/**
|
||||
@@ -9,24 +13,24 @@ import xyz.zhouxy.plusone.commons.util.Enumeration;
|
||||
*/
|
||||
public final class EntityStatus extends Enumeration<EntityStatus> {
|
||||
|
||||
private EntityStatus(int value, String name) {
|
||||
super(value, name);
|
||||
private EntityStatus(int id, @Nonnull String name) {
|
||||
super(id, name);
|
||||
}
|
||||
|
||||
// 常量
|
||||
public static final EntityStatus AVAILABLE = new EntityStatus(0, "正常");
|
||||
public static final EntityStatus DISABLED = new EntityStatus(1, "禁用");
|
||||
|
||||
private static final EnumerationValuesHolder<EntityStatus> ENUMERATION_VALUES = new EnumerationValuesHolder<>(
|
||||
AVAILABLE,
|
||||
DISABLED);
|
||||
private static final ValueSet<EntityStatus> VALUE_SET = new ValueSet<>(
|
||||
AVAILABLE, DISABLED);
|
||||
|
||||
public static EntityStatus of(int value) {
|
||||
return ENUMERATION_VALUES.get(value);
|
||||
@Nonnull
|
||||
public static EntityStatus of(int id) {
|
||||
return VALUE_SET.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EntityStatus" + super.toString();
|
||||
@Nonnull
|
||||
public static Collection<EntityStatus> constants() {
|
||||
return VALUE_SET.getValues();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user