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 public void visit(Column column) {
19 if (StringUtils.isEmpty(column.getType()))
20 addError(column, "column requires type");
21 final ColumnType type = ColumnType.get(column.getType());
22 if (type == null)
23 addError(column, "type '" + column.getType() + "' not found");
24 if (type.isRequiredSize() && column.getSizeAsInt() < 1)
25 addError(column, "type '" + type.getName() + "' requires size");
26 }
27
28 }