private Field parse(SQLTableElement tableElement) throws UnsupportedException {
Field field = null;
FieldKeyWord keyWord = null;
if (tableElement instanceof WaspSqlColumnDefinition) {
WaspSqlColumnDefinition column = (WaspSqlColumnDefinition) tableElement;
if (column.getColumnConstraint() == FieldKeyWord.REQUIRED) {
keyWord = FieldKeyWord.REQUIRED;
} else if (column.getColumnConstraint() == FieldKeyWord.OPTIONAL) {
keyWord = FieldKeyWord.OPTIONAL;
} else if (column.getColumnConstraint() == FieldKeyWord.REPEATED) {
keyWord = FieldKeyWord.REPEATED;
} else {
throw new UnsupportedException("Unsupported ColumnConstraint "
+ column.getColumnConstraint());
}
SQLName name = column.getName();
SQLDataType dataType = column.getDataType();
SQLName columnFamilyName = column.getColumnFamily();
String columnFamily = FConstants.COLUMNFAMILYNAME_STR;
if (columnFamilyName != null) {
columnFamily = parseName(columnFamilyName);
}
field = new Field(keyWord, columnFamily, parseName(name),
parse(dataType), column.getComment());
return field;
} else {
throw new UnsupportedException("Unsupported SQLColumnDefinition "
+ tableElement);
}