AllocationTypeEnum.java 1013 Bytes
package cn.fw.valhalla.common.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

/**
 * @author : kurisu
 * @className : AllocationTypeEnum
 * @description : 分配方式
 * @date: 2020-10-16 17:56
 */
public enum AllocationTypeEnum {
    /**
     * 指定人员
     */
    ONE(1, "指定人员"),
    /**
     * 平均分配
     */
    ALL(2, "平均分配");

    /**
     * 值
     */
    private final Integer value;
    /**
     * 名称
     */
    @Getter
    private final String name;

    AllocationTypeEnum(final Integer value, final String name) {
        this.value = value;
        this.name = name;
    }

    /**
     * 根据枚举值获取枚举对象
     */
    @JsonCreator
    public static AllocationTypeEnum ofValue(final Integer value) {
        for (final AllocationTypeEnum typeEnum : AllocationTypeEnum.values()) {
            if (typeEnum.value.equals(value)) {
                return typeEnum;
            }
        }
        return null;
    }
}