📄 fieldtype.java
字号:
package org.kdb.struct;
/**
* Created by IntelliJ IDEA.
* Date: 2007-11-17
* Time: 14:08:51
*/
public enum FieldType {
INT("int", 0), STRING("string", 1), DATE("date", 2), LONG("long", 3);
private transient String name;
private int index;
private FieldType(String name, int index) {
this.name = name;
this.index = index;
}
public String getName() {
if (name == null) {
name = name().toLowerCase();
}
return name;
}
public int getIndex() {
return index;
}
public static FieldType getType(String type) {
String tp = type.toLowerCase();
if (tp.equals("int")) {
return INT;
} else if (tp.equals("string")) {
return STRING;
} else if (tp.equals("date")) {
return DATE;
} else if (tp.equals("long")) {
return LONG;
} else {
throw new IllegalArgumentException("Illegal type");
}
}
public static FieldType getType(int type) {
switch (type) {
case 0:
return INT;
case 1:
return STRING;
case 2:
return DATE;
case 3:
return LONG;
default:
throw new IllegalArgumentException("Invalid type:" + type);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -