1
2
3
4
5
6
7 package org.asyrinx.joey.gen.command.rdb;
8
9 import org.apache.commons.lang.StringUtils;
10 import org.asyrinx.joey.gen.model.rdb.Column;
11 import org.asyrinx.joey.gen.model.rdb.ColumnType;
12
13 /***
14 * @author akima
15 */
16 public class CheckColumnType extends RdbCommand {
17
18 /***
19 *
20 */
21 public CheckColumnType() {
22 super();
23 }
24
25
26
27
28
29
30 public void visit(Column column) {
31 if (StringUtils.isEmpty(column.getType()))
32 addError(column, "column requires type");
33 final ColumnType type = ColumnType.get(column.getType());
34 if (type == null)
35 addError(column, "type '" + column.getType() + "' not found");
36 if (type.isRequiredSize() && column.getSizeAsInt() < 1)
37 addError(column, "type '" + type.getName() + "' requires size");
38 }
39
40 }