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


Java ColumnType.OTHER属性代码示例

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


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

示例1: toColumnType

protected static ColumnType toColumnType(FieldType type) {
    switch (type) {
    case _boolean:
        return ColumnType.BOOLEAN;
    case _int:
        return ColumnType.INTEGER;
    case _double:
    case currency:
        return ColumnType.DOUBLE;
    case date:
        return ColumnType.DATE;
    case datetime:
        return ColumnType.TIMESTAMP;
    case time:
        return ColumnType.TIME;
    case string:
    case email:
    case url:
    case phone:
    case reference:
    case textarea:
    case encryptedstring:
    case base64:
    case id:
    case picklist:
        return ColumnType.VARCHAR;
    default:
        return ColumnType.OTHER;
    }
}
 
开发者ID:apache,项目名称:metamodel,代码行数:30,代码来源:SalesforceTable.java

示例2: addObservation

public void addObservation(ColumnType columnType) {
    _observationCounter.incrementAndGet();
    if (columnType == null) {
        columnType = ColumnType.OTHER;
    }
    _columnTypes.add(columnType);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:7,代码来源:InferentialColumnBuilder.java

示例3: detectType

private ColumnType detectType() {
    if (_columnTypes.isEmpty()) {
        return ColumnType.OTHER;
    }

    if (_columnTypes.size() == 1) {
        return _columnTypes.iterator().next();
    }

    boolean allStrings = true;
    boolean allNumbers = true;

    for (ColumnType type : _columnTypes) {
        if (allStrings && !type.isLiteral()) {
            allStrings = false;
        } else if (allNumbers && !type.isNumber()) {
            allNumbers = false;
        }
    }

    if (allStrings) {
        return ColumnType.STRING;
    }

    if (allNumbers) {
        return ColumnType.NUMBER;
    }

    return ColumnType.OTHER;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:30,代码来源:InferentialColumnBuilder.java

示例4: convertToColumnType

private ColumnType convertToColumnType(String sugarType) {
    ColumnType columnType = TYPE_MAPPING.get(sugarType);
    if (columnType == null) {
        columnType = ColumnType.OTHER;
    }
    return columnType;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:7,代码来源:SugarCrmTable.java

示例5: getMainSchema

@Override
protected Schema getMainSchema() throws MetaModelException {
    DBF dbf = getDbf();

    String schemaName = dbf.getName();
    int separatorIndex = Math.max(schemaName.lastIndexOf('/'), schemaName.lastIndexOf('\\'));
    if (separatorIndex != -1) {
        schemaName = schemaName.substring(separatorIndex + 1);
    }

    MutableSchema schema = new MutableSchema(schemaName);
    MutableTable table = new MutableTable(schemaName.substring(0, schemaName.length() - 4), TableType.TABLE, schema);
    schema.addTable(table);

    for (int i = 0; i < dbf.getFieldCount(); i++) {
        try {
            Field field = dbf.getField(i + 1);

            MutableColumn column = new MutableColumn(field.getName());
            ColumnType columnType = ColumnType.VARCHAR;

            if (field instanceof FloatField) {
                columnType = ColumnType.FLOAT;
            } else if (field instanceof NumField) {
                columnType = ColumnType.DOUBLE;
            } else if (field instanceof CharField) {
                columnType = ColumnType.CHAR;
            } else if (field instanceof DateField) {
                columnType = ColumnType.DATE;
            } else if (field instanceof MemoField) {
                columnType = ColumnType.VARCHAR;
            } else if (field instanceof LogicalField) {
                columnType = ColumnType.OTHER;
            } else if (field instanceof PictureField) {
                columnType = ColumnType.OTHER;
            }

            column.setType(columnType);
            column.setTable(table);
            column.setColumnNumber(i);
            column.setNativeType("" + field.getType());
            column.setColumnSize(field.getLength());
            table.addColumn(column);
        } catch (Exception e) {
            throw new MetaModelException("Could not retrieve DBF field", e);
        }
    }

    return schema;
}
 
开发者ID:datacleaner,项目名称:metamodel_extras,代码行数:50,代码来源:DbaseDataContext.java

示例6: testQuery

public void testQuery() throws Exception {
	Schema schema = dc.getSchemaByName("METER.DBF");
	Table table = schema.getTableByName("METER");

	List<Column> columns = table.getColumns();
	Query q = new Query().select(columns).from(table);
	assertEquals(ColumnType.CHAR, q.getSelectClause().getItem(0)
			.getColumn().getType());
	assertEquals(ColumnType.CHAR, q.getSelectClause().getItem(6)
			.getColumn().getType());
	assertEquals(ColumnType.CHAR, q.getSelectClause().getItem(7)
			.getColumn().getType());
	assertEquals(ColumnType.CHAR, q.getSelectClause().getItem(8)
			.getColumn().getType());
	assertEquals(ColumnType.CHAR, q.getSelectClause().getItem(9)
			.getColumn().getType());
	assertEquals(ColumnType.DOUBLE, q.getSelectClause().getItem(30)
			.getColumn().getType());
	DataSet ds = dc.executeQuery(q);

	assertTrue(ds.next());

	// create a cross-locale string comparison of the date field
	final String dateString;
	{
		Date date = DateUtils.get(2009, Month.AUGUST, 31);
		dateString = date.toString();
	}

	assertEquals(
			"Row[values=[0002, 0001, 0001, 0001, 0001, 0001, 21, 2008,   -1, N, C, A, 0, 149627, A, "
					+ dateString
					+ ", E, NRC E1                , Electric  , Cost      , $             ,               , SimActual             , Parkwood Hospital     , Parkwood Hospital     , Neuro Rehab Centre    , 2893.26, 2180.46, 4541.75, 2894.24, 2981.31, 2702.11, 2733.67, 2733.67, 2597.37, 2850.39, 2914.74, 2951.58, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 12.0]]",
			ds.getRow().toString());
	assertEquals(Double.class, ds.getRow().getValue(30).getClass());

	while (ds.next()) {
		Row row = ds.getRow();
		List<SelectItem> selectItems = row.getSelectItems();
		for (int i = 0; i < selectItems.size(); i++) {
			SelectItem selectItem = selectItems.get(i);
			Column column = columns.get(i);
			assertSame(selectItem.getColumn(), column);

			Object selectItemValue = row.getValue(selectItem);
			Object columnValue = row.getValue(column);
			assertEquals(selectItemValue, columnValue);

			assertNotNull(columnValue);

			if (column.getType() == ColumnType.CHAR) {
				assertTrue(columnValue instanceof Character
						|| columnValue instanceof String);
			} else if (column.getType() == ColumnType.FLOAT) {
				assertTrue(columnValue instanceof Float);
			} else if (column.getType() == ColumnType.DOUBLE) {
				assertTrue(columnValue instanceof Double);
			} else if (column.getType() == ColumnType.DATE) {
				assertTrue(columnValue instanceof Date);
			} else if (column.getType() == ColumnType.OTHER) {
				System.out.println("other type: " + columnValue);
			} else {
				throw new MetaModelException(
						"Value type not expected for Dbase data: " + column);
			}
		}
	}
	ds.close();
}
 
开发者ID:datacleaner,项目名称:metamodel_extras,代码行数:69,代码来源:DbaseDataContextMeterTest.java

示例7: getColumnTypeFromMetaDataField

private static ColumnType getColumnTypeFromMetaDataField(DataType.Name metaDataName) {
    switch (metaDataName) {
    case BIGINT:
    case COUNTER:
        return ColumnType.BIGINT;
    case BLOB:
        return ColumnType.BLOB;
    case BOOLEAN:
        return ColumnType.BOOLEAN;
    case DECIMAL:
        return ColumnType.DECIMAL;
    case DOUBLE:
        return ColumnType.DOUBLE;
    case FLOAT:
        return ColumnType.FLOAT;
    case INT:
        return ColumnType.INTEGER;
    case TEXT:
        return ColumnType.STRING;
    case TIMESTAMP:
        return ColumnType.TIMESTAMP;
    case UUID:
        return ColumnType.UUID;
    case VARCHAR:
        return ColumnType.VARCHAR;
    case VARINT:
        return ColumnType.BIGINT;
    case LIST:
        return ColumnType.LIST;
    case MAP:
        return ColumnType.MAP;
    case CUSTOM:
        return ColumnType.OTHER;
    case INET:
        return ColumnType.INET;
    case SET:
        return ColumnType.SET;
    default:
        return ColumnType.STRING;
    }
}
 
开发者ID:apache,项目名称:metamodel,代码行数:41,代码来源:CassandraDataContext.java


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