using maven build tools instead

This commit is contained in:
Sola
2015-11-13 17:33:58 +08:00
parent 2dd27b3524
commit 8959b33a04
17 changed files with 104 additions and 0 deletions

View 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;
}
}

View 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;
}
}