private List<Identifier> getIdentifiers(final Table table, final boolean usePrimaryKeys) { final List<Identifier> result = new ArrayList<Identifier>(); // Add fields to the identifier class final Set<Column> columns = usePrimaryKeys ? table.getPrimaryKeys() : table.getColumns(); for (final Column column : columns) { final String columnName = column.getName(); JavaSymbolName fieldName; try { fieldName = new JavaSymbolName(DbreTypeUtils.suggestFieldName(columnName)); } catch (final RuntimeException e) { throw new IllegalArgumentException( "Failed to create field name for column '" + columnName + "' in table '" + table.getName() + "': " + e.getMessage()); } final JavaType fieldType = column.getJavaType(); final String columnDefinition = table.isIncludeNonPortableAttributes() ? column.getTypeName() : ""; result.add( new Identifier( fieldName, fieldType, columnName, column.getColumnSize(), column.getScale(), columnDefinition)); } return result; }
private boolean hasVersionField(final Table table) { if (!table.isDisableVersionFields()) { for (final Column column : table.getColumns()) { if (VERSION.equalsIgnoreCase(column.getName())) { return true; } } } return false; }