View Javadoc

    1   /*
    2    * joey-gen and its relative products are published under the terms
    3    * of the Apache Software License.
    4    *
    5    * Created on 2004/08/15 18:00:19
    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       * (non-Javadoc)
    27       *
    28       * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.Column)
    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  }