File tree Expand file tree Collapse file tree 4 files changed +33
-4
lines changed
src/main/java/org/luckystars/codefactory Expand file tree Collapse file tree 4 files changed +33
-4
lines changed Original file line number Diff line number Diff line change 6
6
*/
7
7
public enum DataType {
8
8
9
+ UNKNOWN ("unknow" ,0x0 ),
9
10
INT ("int" ,0x1 ),
10
11
STRING ("str" ,0x2 ),
11
- BOOL ("bool" ,0x3 );
12
+ BOOL ("bool" ,0x3 ),
13
+ FK ("fk" ,0x4 );
12
14
13
15
private final String name ;
14
16
private final int code ;
@@ -25,21 +27,32 @@ public int getCode() {
25
27
return code ;
26
28
}
27
29
30
+ /**
31
+ * return {@link DataType.UNKNOWN} if no such name
32
+ * @param name
33
+ * @return
34
+ * @author xuechong
35
+ */
28
36
public static DataType findByName (String name ){
29
37
for (DataType data : DataType .values ()) {
30
38
if (data .getName ().equals (name )){
31
39
return data ;
32
40
}
33
41
}
34
- return null ;
42
+ return UNKNOWN ;
35
43
}
36
-
44
+ /**
45
+ * return unknown if no such code
46
+ * @param code
47
+ * @return
48
+ * @author xuechong
49
+ */
37
50
public static DataType findByCode (int code ){
38
51
for (DataType data : DataType .values ()) {
39
52
if (data .getCode () == code ){
40
53
return data ;
41
54
}
42
55
}
43
- return null ;
56
+ return UNKNOWN ;
44
57
}
45
58
}
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
1
+ package org .luckystars .codefactory .core ;
2
+
3
+ public interface Handler {
4
+ public void handle (Context context );
5
+ }
Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ public class Column {
6
6
private String name ;
7
7
private DataType dataType ;
8
8
private String fk ;
9
+
9
10
}
You can’t perform that action at this time.
0 commit comments