@@ -30,8 +30,14 @@ protected Field(String name, String type){
30
30
this .name = name ;
31
31
this .columnName = Utils .camelCaseToUnderScore (name );
32
32
33
+ //Set columnType and tweak type as needed
33
34
if (type .equalsIgnoreCase ("int" )){
34
- type = "integer" ;
35
+ type = "Integer" ;
36
+ columnType = "integer" ;
37
+ }
38
+ else if (type .equalsIgnoreCase ("int[]" )){
39
+ type = "Integer[]" ;
40
+ columnType = "integer array" ;
35
41
}
36
42
else if (type .equalsIgnoreCase ("long" )){
37
43
columnType = "bigint" ;
@@ -44,9 +50,13 @@ else if (type.equalsIgnoreCase("decimal") || type.equalsIgnoreCase("numeric")){
44
50
type = "BigDecimal" ;
45
51
columnType = "numeric" ;
46
52
}
47
- else if (type .equalsIgnoreCase ("text" ) || type .equalsIgnoreCase ("string" )){
48
- type = "string" ;
49
- columnType = "text" ;
53
+ else if (type .equalsIgnoreCase ("text" ) || type .equalsIgnoreCase ("string" ) || type .equalsIgnoreCase ("password" )){
54
+ type = "String" ;
55
+ columnType = "varchar" ; //varchar without the length specifier and text are equivalent
56
+ }
57
+ else if (type .equalsIgnoreCase ("text[]" ) || type .equalsIgnoreCase ("string[]" )){
58
+ type = "String[]" ;
59
+ columnType = "varchar array" ; //same as "text array"
50
60
}
51
61
else if (type .equalsIgnoreCase ("char" )){
52
62
type = "string" ;
@@ -74,17 +84,13 @@ else if (type.equalsIgnoreCase("geometry")){
74
84
type = "Geometry" ;
75
85
columnType = "geometry(GeometryZ)" ;
76
86
}
77
- else if (type .equalsIgnoreCase ("password" )){
78
- //type = "String";
79
- columnType = "text" ;
80
- }
81
87
else { //Model?
82
88
83
89
84
90
if (type .endsWith ("[]" )){ //Array of models
85
91
86
92
String modelName = type .substring (0 , type .length ()-2 );
87
- type = "ArrayList<" + modelName + ">" ;
93
+ type = "ArrayList<" + Utils . capitalize ( modelName ) + ">" ;
88
94
89
95
}
90
96
else { //Single model
0 commit comments