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

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

本文整理了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

  1. /**
  2. * Constructs a {@link SimpleTableDef} using a {@link Table} as a prototype.
  3. *
  4. * @param table
  5. */
  6. public SimpleTableDef(Table table) {
  7. _name = table.getName();
  8. _columnNames = new String[table.getColumnCount()];
  9. _columnTypes = new ColumnType[table.getColumnCount()];
  10. for (int i = 0; i < table.getColumnCount(); i++) {
  11. Column column = table.getColumn(i);
  12. _columnNames[i] = column.getName();
  13. _columnTypes[i] = column.getType();
  14. }
  15. }

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

  1. /**
  2. * Constructs a {@link SimpleTableDef} using a {@link Table} as a prototype.
  3. *
  4. * @param table
  5. */
  6. public SimpleTableDef(Table table) {
  7. _name = table.getName();
  8. _columnNames = new String[table.getColumnCount()];
  9. _columnTypes = new ColumnType[table.getColumnCount()];
  10. for (int i = 0; i < table.getColumnCount(); i++) {
  11. Column column = table.getColumn(i);
  12. _columnNames[i] = column.getName();
  13. _columnTypes[i] = column.getType();
  14. }
  15. }

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

  1. private SimpleTableDef createTableDef(final Table table) {
  2. final int columnCount = table.getColumnCount();
  3. final String[] names = new String[columnCount];
  4. final ColumnType[] types = new ColumnType[columnCount];
  5. for (int i = 0; i < columnCount; i++) {
  6. names[i] = table.getColumn(i).getName();
  7. types[i] = table.getColumn(i).getType();
  8. }
  9. return new SimpleTableDef(table.getName(), names, types);
  10. }

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

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

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

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

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

  1. @Override
  2. public DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) {
  3. final int lineNumber = _configuration.getColumnNameLineNumber();
  4. final int columnCount = table.getColumnCount();
  5. final BufferedReader reader = FileHelper.getBufferedReader(_resource.read(), _configuration.getEncoding());
  6. try {
  7. // skip column header lines
  8. for (int i = 0; i < lineNumber; i++) {
  9. String line = reader.readLine();
  10. if (line == null) {
  11. FileHelper.safeClose(reader);
  12. return EmptyDataSet.fromColumns(columns);
  13. }
  14. }
  15. } catch (IOException e) {
  16. FileHelper.safeClose(reader);
  17. throw new MetaModelException("IOException occurred while reading from CSV resource: " + _resource, e);
  18. }
  19. final boolean failOnInconsistentRowLength = _configuration.isFailOnInconsistentRowLength();
  20. final Integer maxRowsOrNull = (maxRows > 0 ? maxRows : null);
  21. if (_configuration.isMultilineValues()) {
  22. final CSVReader csvReader = createCsvReader(reader);
  23. return new CsvDataSet(csvReader, columns, maxRowsOrNull, columnCount, failOnInconsistentRowLength);
  24. }
  25. return new SingleLineCsvDataSet(reader, createParser(), columns, maxRowsOrNull, columnCount,
  26. failOnInconsistentRowLength);
  27. }

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

  1. @Override
  2. public DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) {
  3. final int lineNumber = _configuration.getColumnNameLineNumber();
  4. final int columnCount = table.getColumnCount();
  5. final BufferedReader reader = FileHelper.getBufferedReader(_resource.read(), _configuration.getEncoding());
  6. try {
  7. // skip column header lines
  8. for (int i = 0; i < lineNumber; i++) {
  9. String line = reader.readLine();
  10. if (line == null) {
  11. FileHelper.safeClose(reader);
  12. return EmptyDataSet.fromColumns(columns);
  13. }
  14. }
  15. } catch (IOException e) {
  16. FileHelper.safeClose(reader);
  17. throw new MetaModelException("IOException occurred while reading from CSV resource: " + _resource, e);
  18. }
  19. final boolean failOnInconsistentRowLength = _configuration.isFailOnInconsistentRowLength();
  20. final Integer maxRowsOrNull = (maxRows > 0 ? maxRows : null);
  21. if (_configuration.isMultilineValues()) {
  22. final CSVReader csvReader = createCsvReader(reader);
  23. return new CsvDataSet(csvReader, columns, maxRowsOrNull, columnCount, failOnInconsistentRowLength);
  24. }
  25. return new SingleLineCsvDataSet(reader, createParser(), columns, maxRowsOrNull, columnCount,
  26. failOnInconsistentRowLength);
  27. }

相关文章