org.apache.metamodel.schema.Table.getColumnCount()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中org.apache.metamodel.schema.Table.getColumnCount()方法的一些代码示例,展示了Table.getColumnCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getColumnCount()方法的具体详情如下:
包路径:org.apache.metamodel.schema.Table
类名称:Table
方法名:getColumnCount

Table.getColumnCount介绍

[英]Gets the number of columns in this table.
[中]

代码示例

代码示例来源:origin: org.apache.metamodel/MetaModel-core

/**
 * Constructs a {@link SimpleTableDef} using a {@link Table} as a prototype.
 * 
 * @param table
 */
public SimpleTableDef(Table table) {
  _name = table.getName();
  _columnNames = new String[table.getColumnCount()];
  _columnTypes = new ColumnType[table.getColumnCount()];
  for (int i = 0; i < table.getColumnCount(); i++) {
    Column column = table.getColumn(i);
    _columnNames[i] = column.getName();
    _columnTypes[i] = column.getType();
  }
}

代码示例来源:origin: apache/metamodel

/**
 * Constructs a {@link SimpleTableDef} using a {@link Table} as a prototype.
 * 
 * @param table
 */
public SimpleTableDef(Table table) {
  _name = table.getName();
  _columnNames = new String[table.getColumnCount()];
  _columnTypes = new ColumnType[table.getColumnCount()];
  for (int i = 0; i < table.getColumnCount(); i++) {
    Column column = table.getColumn(i);
    _columnNames[i] = column.getName();
    _columnTypes[i] = column.getType();
  }
}

代码示例来源:origin: datacleaner/DataCleaner

private SimpleTableDef createTableDef(final Table table) {
  final int columnCount = table.getColumnCount();
  final String[] names = new String[columnCount];
  final ColumnType[] types = new ColumnType[columnCount];
  for (int i = 0; i < columnCount; i++) {
    names[i] = table.getColumn(i).getName();
    types[i] = table.getColumn(i).getType();
  }
  return new SimpleTableDef(table.getName(), names, types);
}

代码示例来源:origin: apache/metamodel

new Object[] { t.getName(), typeString, t.getColumnCount(), t.getRemarks() }));

代码示例来源:origin: org.apache.metamodel/MetaModel-core

new Object[] { t.getName(), typeString, t.getColumnCount(), t.getRemarks() }));

代码示例来源:origin: apache/metamodel

@Override
public DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) {
  final int lineNumber = _configuration.getColumnNameLineNumber();
  final int columnCount = table.getColumnCount();
  final BufferedReader reader = FileHelper.getBufferedReader(_resource.read(), _configuration.getEncoding());
  try {
    // skip column header lines
    for (int i = 0; i < lineNumber; i++) {
      String line = reader.readLine();
      if (line == null) {
        FileHelper.safeClose(reader);
        return EmptyDataSet.fromColumns(columns);
      }
    }
  } catch (IOException e) {
    FileHelper.safeClose(reader);
    throw new MetaModelException("IOException occurred while reading from CSV resource: " + _resource, e);
  }
  final boolean failOnInconsistentRowLength = _configuration.isFailOnInconsistentRowLength();
  final Integer maxRowsOrNull = (maxRows > 0 ? maxRows : null);
  if (_configuration.isMultilineValues()) {
    final CSVReader csvReader = createCsvReader(reader);
    return new CsvDataSet(csvReader, columns, maxRowsOrNull, columnCount, failOnInconsistentRowLength);
  }
  return new SingleLineCsvDataSet(reader, createParser(), columns, maxRowsOrNull, columnCount,
      failOnInconsistentRowLength);
}

代码示例来源:origin: org.apache.metamodel/MetaModel-csv

@Override
public DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) {
  final int lineNumber = _configuration.getColumnNameLineNumber();
  final int columnCount = table.getColumnCount();
  final BufferedReader reader = FileHelper.getBufferedReader(_resource.read(), _configuration.getEncoding());
  try {
    // skip column header lines
    for (int i = 0; i < lineNumber; i++) {
      String line = reader.readLine();
      if (line == null) {
        FileHelper.safeClose(reader);
        return EmptyDataSet.fromColumns(columns);
      }
    }
  } catch (IOException e) {
    FileHelper.safeClose(reader);
    throw new MetaModelException("IOException occurred while reading from CSV resource: " + _resource, e);
  }
  final boolean failOnInconsistentRowLength = _configuration.isFailOnInconsistentRowLength();
  final Integer maxRowsOrNull = (maxRows > 0 ? maxRows : null);
  if (_configuration.isMultilineValues()) {
    final CSVReader csvReader = createCsvReader(reader);
    return new CsvDataSet(csvReader, columns, maxRowsOrNull, columnCount, failOnInconsistentRowLength);
  }
  return new SingleLineCsvDataSet(reader, createParser(), columns, maxRowsOrNull, columnCount,
      failOnInconsistentRowLength);
}

相关文章