class JDBCUtils {

    public static List<Column> getColumns(ResultSet resultSet, String[] exclude) {
        try {
            List<Column> columnList = new ArrayList<>();
            List<String> columnExcluded = exclude == null ? new ArrayList<String>() : Arrays.asList(exclude);
        
            ResultSetMetaData meta = resultSet.getMetaData();
            for (int i = 1; i <= meta.getColumnCount(); i++) {
            String name = meta.getColumnName(i);
            String alias = meta.getColumnLabel(i);
            if (alias != null && !alias.trim().isEmpty()) {
                name = alias.trim();
            }
            if (!columnExcluded.contains(name) && !columnExcluded.contains(alias)) {
                ColumnType type = JDBCUtils.calculateType(meta.getColumnType(i));
                if (type != null) {
                    int size = meta.getColumnDisplaySize(i);
                    Column column = SQLFactory.column(name, type, size);
                    columnList.add(column);
                }
            }
             }
            return columnList;
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

}