top.doudou.common.tool.constant.BrowserEnum Maven / Gradle / Ivy
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 BrowserEnum implements IEnum {
micromessenger("micromessenger", "微信浏览器"),
Chrome("Chrome", "谷歌浏览器"),
Firefox("Firefox", "火狐浏览器"),
IE("IE", "IE浏览器"),
SE_360("360SE", "360浏览器"),
Safari("Safari", "Safari浏览器"),
Opera("Opera", "Opera浏览器"),
The_World("The_World", "The World浏览器"),
Avant_Browser("Avant Browser", "Avant Browser浏览器"),
MQQBrowser("MQQBrowser", "QQ浏览器");
@EnumValue
private String code;
private String codeInfo;
private BrowserEnum(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 BrowserEnum getBrowserEnum(String code) {
try {
return BrowserEnum.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;
}
}