Skip to content

Commit a14b73b

Browse files
committed
add some ...
1 parent 4918f33 commit a14b73b

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

src/main/java/org/luckystars/codefactory/constants/DataType.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
*/
77
public enum DataType {
88

9+
UNKNOWN("unknow",0x0),
910
INT("int",0x1),
1011
STRING("str",0x2),
11-
BOOL("bool",0x3);
12+
BOOL("bool",0x3),
13+
FK("fk",0x4);
1214

1315
private final String name;
1416
private final int code;
@@ -25,21 +27,32 @@ public int getCode() {
2527
return code;
2628
}
2729

30+
/**
31+
* return {@link DataType.UNKNOWN} if no such name
32+
* @param name
33+
* @return
34+
* @author xuechong
35+
*/
2836
public static DataType findByName(String name){
2937
for (DataType data : DataType.values()) {
3038
if(data.getName().equals(name)){
3139
return data;
3240
}
3341
}
34-
return null;
42+
return UNKNOWN;
3543
}
36-
44+
/**
45+
* return unknown if no such code
46+
* @param code
47+
* @return
48+
* @author xuechong
49+
*/
3750
public static DataType findByCode(int code){
3851
for (DataType data : DataType.values()) {
3952
if(data.getCode() == code){
4053
return data;
4154
}
4255
}
43-
return null;
56+
return UNKNOWN;
4457
}
4558
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.luckystars.codefactory.core;
2+
3+
import java.util.Map;
4+
5+
import org.luckystars.codefactory.model.TableContext;
6+
7+
public class Context {
8+
Map<String, TableContext> tables ;
9+
10+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.luckystars.codefactory.core;
2+
3+
public interface Handler {
4+
public void handle(Context context);
5+
}

src/main/java/org/luckystars/codefactory/model/Column.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ public class Column {
66
private String name;
77
private DataType dataType;
88
private String fk;
9+
910
}

0 commit comments

Comments
 (0)