plusone-commons 做了调整。
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package xyz.zhouxy.plusone.system.domain.model.account;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import lombok.Getter;
|
||||
import xyz.zhouxy.plusone.commons.util.Enumeration;
|
||||
import xyz.zhouxy.plusone.domain.IValueObject;
|
||||
@@ -12,18 +16,23 @@ import xyz.zhouxy.plusone.domain.IValueObject;
|
||||
@Getter
|
||||
public final class AccountStatus extends Enumeration<AccountStatus> implements IValueObject {
|
||||
|
||||
private AccountStatus(int value, String name) {
|
||||
super(value, name);
|
||||
private AccountStatus(int id, @Nonnull String name) {
|
||||
super(id, name);
|
||||
}
|
||||
|
||||
public static final AccountStatus AVAILABLE = new AccountStatus(0, "账号正常");
|
||||
public static final AccountStatus LOCKED = new AccountStatus(1, "账号被锁定");
|
||||
|
||||
private static final EnumerationValuesHolder<AccountStatus> ENUMERATION_VALUES = new EnumerationValuesHolder<>(
|
||||
private static final ValueSet<AccountStatus> VALUE_SET = new ValueSet<>(
|
||||
AVAILABLE,
|
||||
LOCKED);
|
||||
|
||||
public static AccountStatus of(int value) {
|
||||
return ENUMERATION_VALUES.get(value);
|
||||
public static AccountStatus of(int id) {
|
||||
return VALUE_SET.get(id);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static Collection<AccountStatus> constants() {
|
||||
return VALUE_SET.getValues();
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package xyz.zhouxy.plusone.system.domain.model.account;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import xyz.zhouxy.plusone.commons.util.Enumeration;
|
||||
@@ -18,16 +20,19 @@ public final class Sex extends Enumeration<Sex> implements IValueObject {
|
||||
@Nonnull
|
||||
public static final Sex FEMALE = new Sex(2, "女性");
|
||||
|
||||
private Sex(int value, String name) {
|
||||
super(value, name);
|
||||
private Sex(int id, @Nonnull String name) {
|
||||
super(id, name);
|
||||
}
|
||||
|
||||
private static EnumerationValuesHolder<Sex> values = new EnumerationValuesHolder<>(
|
||||
UNSET,
|
||||
MALE,
|
||||
FEMALE);
|
||||
private static final ValueSet<Sex> VALUE_SET = new ValueSet<>(UNSET, MALE, FEMALE);
|
||||
|
||||
@Nonnull
|
||||
public static Sex of(int value) {
|
||||
return values.get(value);
|
||||
return VALUE_SET.get(value);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static Collection<Sex> constants() {
|
||||
return VALUE_SET.getValues();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user