当前位置: 首页>>代码示例>>Java>>正文


Java ColumnType.VARCHAR属性代码示例

本文整理汇总了Java中org.apache.metamodel.schema.ColumnType.VARCHAR属性的典型用法代码示例。如果您正苦于以下问题:Java ColumnType.VARCHAR属性的具体用法?Java ColumnType.VARCHAR怎么用?Java ColumnType.VARCHAR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.metamodel.schema.ColumnType的用法示例。


在下文中一共展示了ColumnType.VARCHAR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addField

private void addField(String name, ColumnType columnType) {
    if (name == null) {
        name = "";
    }
    final JXTextField nameTextField = WidgetFactory.createTextField();
    nameTextField.setText(name);

    if (columnType == null) {
        columnType = ColumnType.VARCHAR;
    }
    final DCComboBox<ColumnType> typeComboBox = new DCComboBox<>(getAvailableColumnTypes());
    typeComboBox.setRenderer(new EnumComboBoxListRenderer());
    typeComboBox.setSelectedItem(columnType);

    _tableModel.addRow(new Object[] { nameTextField, typeComboBox });
    updateUI();
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:17,代码来源:SimpleTableDefPanel.java

示例2: getColumnType

private ColumnType getColumnType(ValueMetaInterface valueMeta) {
    switch (valueMeta.getType()) {
    case ValueMetaInterface.TYPE_STRING:
        return ColumnType.VARCHAR;
    case ValueMetaInterface.TYPE_INTEGER:
        return ColumnType.INTEGER;
    case ValueMetaInterface.TYPE_DATE:
        return ColumnType.DATE;
    case ValueMetaInterface.TYPE_BOOLEAN:
        return ColumnType.BOOLEAN;
    case ValueMetaInterface.TYPE_NUMBER:
        return ColumnType.DOUBLE;
    case ValueMetaInterface.TYPE_BINARY:
        return ColumnType.BINARY;
    case ValueMetaInterface.TYPE_BIGNUMBER:
        return ColumnType.DECIMAL;
    }
    throw new RuntimeException("It is currently not possible to profile values of type: " + valueMeta.getTypeDesc());
}
 
开发者ID:datacleaner,项目名称:pdi-datacleaner,代码行数:19,代码来源:KettleDataContext.java

示例3: createColumns

/**
 * Builds columns based on row/cell values.
 * 
 * @param table
 * @param wb
 * @param row
 */
private void createColumns(MutableTable table, Workbook wb, Row row) {
    if (row == null) {
        logger.warn("Cannot create columns based on null row!");
        return;
    }
    final short rowLength = row.getLastCellNum();

    final int offset = getColumnOffset(row);

    // build columns based on cell values.
    try (final ColumnNamingSession columnNamingSession = _configuration.getColumnNamingStrategy()
            .startColumnNamingSession()) {
        for (int j = offset; j < rowLength; j++) {
            final Cell cell = row.getCell(j);
            final String intrinsicColumnName = ExcelUtils.getCellValue(wb, cell);
            final ColumnNamingContext columnNamingContext = new ColumnNamingContextImpl(table, intrinsicColumnName,
                    j);
            final String columnName = columnNamingSession.getNextColumnName(columnNamingContext);
            final Column column = new MutableColumn(columnName, ColumnType.VARCHAR, table, j, true);
            table.addColumn(column);
        }
    }
}
 
开发者ID:apache,项目名称:metamodel,代码行数:30,代码来源:DefaultSpreadsheetReaderDelegate.java

示例4: rewriteColumnType

@Override
public String rewriteColumnType(ColumnType columnType, Integer columnSize) {
    if (columnType == ColumnType.INTEGER) {
        return "INT";
    }

    if(columnType == ColumnType.STRING) {
        return "STRING";
    }

    // Hive does not support VARCHAR without a width, nor VARCHAR(MAX).
    // Returning max allowable column size instead.
    if (columnType == ColumnType.VARCHAR && columnSize == null) {
        return super.rewriteColumnType(columnType, 65535);
    }
    return super.rewriteColumnType(columnType, columnSize);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:17,代码来源:HiveQueryRewriter.java

示例5: SimpleTableDef

/**
 * Constructs a {@link SimpleTableDef}.
 * 
 * @param name
 *            the name of table
 * @param columnNames
 *            the names of the columns to include in the table
 * @param columnTypes
 *            the column types of the columns specified.
 */
public SimpleTableDef(String name, String[] columnNames, ColumnType[] columnTypes) {
    if(name == null){
        throw new NullPointerException("Table name cannot be null");
    }
    _name = name;
    _columnNames = columnNames;
    if (columnTypes == null) {
        columnTypes = new ColumnType[columnNames.length];
        for (int i = 0; i < columnTypes.length; i++) {
            columnTypes[i] = ColumnType.VARCHAR;
        }
    } else {
        if (columnNames.length != columnTypes.length) {
            throw new IllegalArgumentException(
                    "Property names and column types cannot have different lengths (found " + columnNames.length
                            + " and " + columnTypes.length + ")");
        }
    }
    _columnTypes = columnTypes;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:30,代码来源:SimpleTableDef.java

示例6: testExpressionBasedFilter

public void testExpressionBasedFilter() throws Exception {
    FilterItem filterItem = new FilterItem("foobar");
    assertEquals("foobar", filterItem.getExpression());

    try {
        filterItem.evaluate(null);
        fail("Exception should have been thrown");
    } catch (Exception e) {
        assertEquals("Expression-based filters cannot be manually evaluated", e.getMessage());
    }

    Column col1 = new MutableColumn("Col1", ColumnType.VARCHAR);
    assertEquals("SELECT Col1 WHERE foobar", new Query().select(col1).where(filterItem).toString());

    assertEquals("SELECT Col1 WHERE YEAR(Col1) = 2008", new Query().select(col1).where("YEAR(Col1) = 2008")
            .toString());
}
 
开发者ID:apache,项目名称:metamodel,代码行数:17,代码来源:FilterItemTest.java

示例7: testOrFilterItem

public void testOrFilterItem() throws Exception {
    Column col1 = new MutableColumn("Col1", ColumnType.VARCHAR);

    SelectItem s1 = new SelectItem(col1);
    FilterItem c1 = new FilterItem(s1, OperatorType.EQUALS_TO, "foo");
    FilterItem c2 = new FilterItem(s1, OperatorType.EQUALS_TO, "bar");
    FilterItem c3 = new FilterItem(s1, OperatorType.EQUALS_TO, "foobar");

    FilterItem filter = new FilterItem(c1, c2, c3);
    assertEquals("(Col1 = 'foo' OR Col1 = 'bar' OR Col1 = 'foobar')", filter.toString());

    DataSetHeader header = new SimpleDataSetHeader(new SelectItem[] { s1 });

    assertTrue(filter.evaluate(new DefaultRow(header, new Object[] { "foo" })));
    assertTrue(filter.evaluate(new DefaultRow(header, new Object[] { "bar" })));
    assertTrue(filter.evaluate(new DefaultRow(header, new Object[] { "foobar" })));

    assertFalse(filter.evaluate(new DefaultRow(header, new Object[] { "foob" })));
}
 
开发者ID:apache,项目名称:metamodel,代码行数:19,代码来源:FilterItemTest.java

示例8: testAndFilterItem

public void testAndFilterItem() throws Exception {
    Column col1 = new MutableColumn("Col1", ColumnType.VARCHAR);

    SelectItem s1 = new SelectItem(col1);
    FilterItem c1 = new FilterItem(s1, OperatorType.LIKE, "foo%");
    FilterItem c2 = new FilterItem(s1, OperatorType.LIKE, "%bar");
    FilterItem c3 = new FilterItem(s1, OperatorType.DIFFERENT_FROM, "foobar");

    FilterItem filter = new FilterItem(LogicalOperator.AND, c1, c2, c3);
    assertEquals("(Col1 LIKE 'foo%' AND Col1 LIKE '%bar' AND Col1 <> 'foobar')", filter.toString());

    CachingDataSetHeader header = new CachingDataSetHeader(Lists.newArrayList(s1));
    assertTrue(filter.evaluate(new DefaultRow(header, new Object[] { "foo bar" })));
    assertTrue(filter.evaluate(new DefaultRow(header, new Object[] { "foosenbar" })));
    assertFalse(filter.evaluate(new DefaultRow(header, new Object[] { "foo" })));
    assertFalse(filter.evaluate(new DefaultRow(header, new Object[] { "hello world" })));
    assertFalse(filter.evaluate(new DefaultRow(header, new Object[] { "foobar" })));
}
 
开发者ID:apache,项目名称:metamodel,代码行数:18,代码来源:FilterItemTest.java

示例9: testDefaultSelectAll

public void testDefaultSelectAll() throws Exception {
    final DataCleanerConfiguration configuration = new DataCleanerConfigurationImpl();

    try (AnalysisJobBuilder ajb = new AnalysisJobBuilder(configuration)) {
        ajb.addSourceColumn(new MutableColumn("foo", ColumnType.VARCHAR));
        final MutableColumn barColumn = new MutableColumn("bar", ColumnType.VARCHAR);
        ajb.addSourceColumn(barColumn);
        ajb.addSourceColumn(new MutableColumn("baz", ColumnType.INTEGER));

        final AnalyzerComponentBuilder<StringAnalyzer> beanJobBuilder = ajb.addAnalyzer(StringAnalyzer.class);
        final ConfiguredPropertyDescriptor property =
                beanJobBuilder.getDescriptor().getConfiguredPropertiesForInput().iterator().next();

        final MultipleInputColumnsPropertyWidget widget =
                new MultipleInputColumnsPropertyWidget(beanJobBuilder, property);
        widget.onPanelAdd();

        // initialize with null
        widget.initialize(null);
        widget.selectAll();
        InputColumn<?>[] value = widget.getValue();
        assertEquals("[MetaModelInputColumn[foo], MetaModelInputColumn[bar]]", Arrays.toString(value));

        // add another available column
        ajb.addSourceColumn(new MutableColumn("foobar", ColumnType.VARCHAR));

        value = widget.getValue();
        assertEquals("[MetaModelInputColumn[foo], MetaModelInputColumn[bar]]", Arrays.toString(value));
        assertEquals("foo,bar,foobar", getAvailableCheckBoxValues(widget));

        // remove a column
        ajb.removeSourceColumn(barColumn);

        value = widget.getValue();
        assertEquals("[MetaModelInputColumn[foo]]", Arrays.toString(value));
        assertEquals("foo,foobar", getAvailableCheckBoxValues(widget));

        widget.onPanelRemove();
    }
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:40,代码来源:MultipleInputColumnsPropertyWidgetTest.java

示例10: testSimpleScenario

public void testSimpleScenario() throws Exception {
	NameStandardizerTransformer transformer = new NameStandardizerTransformer();
	Column column = new MutableColumn("name", ColumnType.VARCHAR);

	MetaModelInputColumn inputColumn = new MetaModelInputColumn(column);
	transformer.setInputColumn(inputColumn);

	transformer.init();

	assertEquals("[John, Doh, Doe, null]",
			Arrays.toString(transformer.transform("John Doe Doh")));

	assertEquals("[John, Doh, Doe, null]",
			Arrays.toString(transformer.transform("Doh, John Doe")));

	assertEquals("[Kasper, Sørensen, null, null]",
			Arrays.toString(transformer.transform("Kasper Sørensen")));

	assertEquals("[Kasper, Sørensen, null, null]",
			Arrays.toString(transformer.transform("Sørensen, Kasper")));
	
	assertEquals("[Kasper, Sørensen, null, Mr]",
			Arrays.toString(transformer.transform("Mr. Kasper Sørensen")));
	
	assertEquals("[Kasper, Sørensen, null, Mister]",
			Arrays.toString(transformer.transform("Mister Kasper Sørensen")));
	
	assertEquals("[Jane, Foobar, Doe, Mrs]",
			Arrays.toString(transformer.transform("Mrs. Jane Doe Foobar")));
}
 
开发者ID:datacleaner,项目名称:AnalyzerBeans,代码行数:30,代码来源:NameStandardizerTransformerTest.java

示例11: testScenarioWithMap

public void testScenarioWithMap() throws Exception {
    final SimpleTableDef tableDef = new SimpleTableDef("bar", new String[] { "col1", "col2", "col3" },
            new ColumnType[] { ColumnType.VARCHAR, ColumnType.INTEGER, ColumnType.BOOLEAN });
    final List<Map<String, ?>> maps = new ArrayList<Map<String, ?>>();
    maps.add(createMap("2", 1000, true));
    maps.add(createMap("1", 1001, false));
    maps.add(createMap("1", 1002, true));
    maps.add(createMap("2", 1003, false));
    maps.add(createMap("2", 1004, false));
    final TableDataProvider<?> tableDataProvider = new MapTableDataProvider(tableDef, maps);
    runScenario(tableDataProvider);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:12,代码来源:PojoDataContextTest.java

示例12: testScenarioWithArrays

public void testScenarioWithArrays() throws Exception {
    final SimpleTableDef tableDef = new SimpleTableDef("bar", new String[] { "col1", "col2", "col3" },
            new ColumnType[] { ColumnType.VARCHAR, ColumnType.INTEGER, ColumnType.BOOLEAN });
    final List<Object[]> arrays = new ArrayList<Object[]>();
    arrays.add(new Object[] { "2", 1000, true });
    arrays.add(new Object[] { "1", 1001, false });
    arrays.add(new Object[] { "1", 1002, true });
    arrays.add(new Object[] { "2", 1003, false });
    arrays.add(new Object[] { "2", 1004, false });
    final TableDataProvider<?> tableDataProvider = new ArrayTableDataProvider(tableDef, arrays);
    runScenario(tableDataProvider);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:12,代码来源:PojoDataContextTest.java

示例13: rewriteColumnType

@Override
public String rewriteColumnType(ColumnType columnType, Integer columnSize) {
    if (columnType == ColumnType.NUMERIC) {
        return super.rewriteColumnType(ColumnType.DECIMAL, columnSize);
    }
    if (columnType.isLiteral() && columnSize == null) {
        if (columnType == ColumnType.STRING || columnType == ColumnType.VARCHAR
                || columnType == ColumnType.NVARCHAR) {
            // MySQL requires size to be specified, so instead we choose the
            // text type
            return "TEXT";
        }
    }
    return super.rewriteColumnType(columnType, columnSize);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:15,代码来源:MysqlQueryRewriter.java

示例14: setUp

@Override
protected void setUp() throws Exception {
    super.setUp();
    if (isConfigured()) {
        final String zookeeperHostname = getZookeeperHostname();
        final int zookeeperPort = getZookeeperPort();
        final HBaseConfiguration configuration = new HBaseConfiguration(zookeeperHostname, zookeeperPort,
                ColumnType.VARCHAR);
        _dataContext = new HBaseDataContext(configuration);
        createTableNatively();
    }
}
 
开发者ID:apache,项目名称:metamodel,代码行数:12,代码来源:HBaseDataContextTest.java

示例15: testHavingClauseReferencingFunctionAndOperand

public void testHavingClauseReferencingFunctionAndOperand() throws Exception {
    MutableColumn idColumn = new MutableColumn("id", ColumnType.VARCHAR);
    SelectItem countSelectItem = new SelectItem(FunctionType.COUNT, idColumn);
    SelectItem idSelectItem = new SelectItem(idColumn).setAlias("innerIdColumn");

    Query q = new Query();
    q.select(idSelectItem);
    q.groupBy(idColumn);
    q.having(new FilterItem(countSelectItem, OperatorType.EQUALS_TO, 2));

    assertEquals("SELECT id AS innerIdColumn GROUP BY id HAVING COUNT(id) = 2", q.toSql());
}
 
开发者ID:apache,项目名称:metamodel,代码行数:12,代码来源:QueryTest.java


注:本文中的org.apache.metamodel.schema.ColumnType.VARCHAR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。