mirror of
https://github.com/ZSCNetSupportDept/WechatTicketSystem.git
synced 2025-10-30 01:46:18 +08:00
using maven build tools instead
This commit is contained in:
56
src/main/java/love/sola/netsupport/enums/ISPType.java
Normal file
56
src/main/java/love/sola/netsupport/enums/ISPType.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package love.sola.netsupport.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ***********************************************
|
||||
* Created by Sola on 2014/8/20.
|
||||
* Don't modify this source without my agreement
|
||||
* ***********************************************
|
||||
*/
|
||||
public enum ISPType {
|
||||
|
||||
TELECOM("Telecom", 1),
|
||||
UNICOM("Unicom", 2),
|
||||
CHINAMOBILE("ChinaMobile", 3),;
|
||||
|
||||
private static final Map<String, ISPType> NAME_MAP = new HashMap<>();
|
||||
private static final Map<Integer, ISPType> ID_MAP = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (ISPType type : values()) {
|
||||
if (type.name != null) {
|
||||
NAME_MAP.put(type.name.toLowerCase(), type);
|
||||
}
|
||||
if (type.id > 0) {
|
||||
ID_MAP.put(type.id, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final String name;
|
||||
public final int id;
|
||||
|
||||
ISPType(String name, int id) {
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static ISPType fromName(String name) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
return NAME_MAP.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
public static ISPType fromId(int id) {
|
||||
return ID_MAP.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
47
src/main/java/love/sola/netsupport/enums/ResponseCode.java
Normal file
47
src/main/java/love/sola/netsupport/enums/ResponseCode.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package love.sola.netsupport.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ***********************************************
|
||||
* Created by Sola on 2015/11/6.
|
||||
* Don't modify this source without my agreement
|
||||
* ***********************************************
|
||||
*/
|
||||
public enum ResponseCode {
|
||||
|
||||
OK(0, "OK"),
|
||||
PARAMETER_REQUIRED(-1, "Parameter Required"),
|
||||
ILLEGAL_PARAMETER(-2, "Illegal parameter"),
|
||||
USER_NOT_FOUND(-11, "User not found"),
|
||||
;
|
||||
|
||||
private static final Map<Integer, ResponseCode> ID_MAP = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (ResponseCode type : values()) {
|
||||
if (type.id > 0) {
|
||||
ID_MAP.put(type.id, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final String info;
|
||||
public final int id;
|
||||
|
||||
ResponseCode(int id, String info) {
|
||||
this.info = info;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static ResponseCode fromId(int id) {
|
||||
return ID_MAP.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user