package com.mindskip.xzs.domain.enums; import java.util.HashMap; import java.util.Map; /** * @version 2.2.0 * @description: 试卷类型 * Copyright (C), 2020-2021, 武汉思维跳跃科技有限公司 * @date 2021 /9/7 9:45 */ public enum ExamPaperTypeEnum { /** * Fixed exam paper type enum. */ Fixed(1, "固定试卷"), /** * Classes exam paper type enum. */ Classes(3, "班级试卷"), /** * Time limit exam paper type enum. */ TimeLimit(4, "时段试卷"), /** * Task exam paper type enum. */ Task(6, "任务试卷"), /** * Random exam paper type enum. */ Random(7, "随机试卷"); /** * The Code. */ int code; /** * The Name. */ String name; ExamPaperTypeEnum(int code, String name) { this.code = code; this.name = name; } private static final Map keyMap = new HashMap<>(); static { for (ExamPaperTypeEnum item : ExamPaperTypeEnum.values()) { keyMap.put(item.getCode(), item); } } /** * From code exam paper type enum. * * @param code the code * @return the exam paper type enum */ public static ExamPaperTypeEnum fromCode(Integer code) { return keyMap.get(code); } /** * Gets code. * * @return the code */ public int getCode() { return code; } /** * Sets code. * * @param code the code */ public void setCode(int code) { this.code = code; } /** * Gets name. * * @return the name */ public String getName() { return name; } /** * Sets name. * * @param name the name */ public void setName(String name) { this.name = name; } }