All Downloads are FREE. Search and download functionalities are using the official Maven repository.

top.doudou.common.tool.constant.ReqClientEnum Maven / Gradle / Ivy

There is a newer version: 1.3.2
Show newest version
package top.doudou.common.tool.constant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.core.enums.IEnum;
import top.doudou.base.exception.ParameterException;

/**
 * @Description
 * @Author 傻男人 <[email protected]>
 * @Date 2020-09-25 10:25
 * @Version V1.0
 */
public enum ReqClientEnum implements IEnum {

    Android("Android", "安卓端"),
    WINDOWS10("Windows NT 10.0", "Windows10"),
    windows_phone("Windows Phone", "windows phone"),
    iPhone("iPhone", "苹果手机"),
    iPad("iPad", "平板"),
    iPod("iPod", "苹果iPod"),
    WINDOWS("Windows NT", "windows系统");

    @EnumValue
    private String code;
    private String codeInfo;

    private ReqClientEnum(String code, String codeInfo) {
        this.code = code;
        this.codeInfo = codeInfo;
    }

    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getCodeInfo() {
        return this.codeInfo;
    }

    public static ReqClientEnum getBrowserEnum(String code) {
        try {
            return ReqClientEnum.valueOf(code);
        } catch (Exception e) {
            throw new ParameterException("请求端类型参数错误");
        }
    }

    public static String getCodeInfoByCode(String code) {
        try {
            return getBrowserEnum(code).codeInfo;
        } catch (Exception e) {
        }
        return null;
    }

    @Override
    public String getValue() {
        return this.code;
    }
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy