本文整理匯總了Java中com.datastax.driver.core.DataType.bigint方法的典型用法代碼示例。如果您正苦於以下問題:Java DataType.bigint方法的具體用法?Java DataType.bigint怎麽用?Java DataType.bigint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.datastax.driver.core.DataType
的用法示例。
在下文中一共展示了DataType.bigint方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: currentRowField
import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
/** Get a field for the current row from the underlying object.
*
* @param index Index of the field within the Row object
* @param typeName Type of the field in this row
*/
private Object currentRowField(int index, SqlTypeName typeName) {
DataType type = current.getColumnDefinitions().getType(index);
if (type == DataType.ascii() || type == DataType.text() || type == DataType.varchar()) {
return current.getString(index);
} else if (type == DataType.cint() || type == DataType.varint()) {
return current.getInt(index);
} else if (type == DataType.bigint()) {
return current.getLong(index);
} else if (type == DataType.cdouble()) {
return current.getDouble(index);
} else if (type == DataType.cfloat()) {
return current.getFloat(index);
} else if (type == DataType.uuid() || type == DataType.timeuuid()) {
return current.getUUID(index).toString();
} else {
return null;
}
}
示例2: getHecubaClientManagerWithLongKeys
import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
public HecubaClientManager<Long> getHecubaClientManagerWithLongKeys(CassandraParamsBean parameters,
HecubaConstants.CassandraClientImplementation cassandraManagerType) {
switch (cassandraManagerType) {
case ASTYANAX:
return new AstyanaxBasedHecubaClientManager<>(parameters,
com.netflix.astyanax.serializers.LongSerializer.get());
case HECTOR:
return new HectorBasedHecubaClientManager<>(parameters,
me.prettyprint.cassandra.serializers.LongSerializer.get());
case DATASTAX:
return new DataStaxBasedHecubaClientManager<>(parameters, DataType.bigint());
case DATASTAX_SHARED:
return new DataStaxBasedSharedHecubaClientManager<>(parameters, DataType.bigint());
default:
throw new RuntimeException("Unhandled CassandraManagerType: " + cassandraManagerType);
}
}
示例3: retrieveKeysBySecondaryIndex
import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public List<K> retrieveKeysBySecondaryIndex(String columnName, String columnValue) {
final String query = "select * from " + secondaryIndexColumnFamily + " where "
+ secondaryIndexKeyColumn + " = ?";
CassandraResultSet<K, String> keysResultSet = read(query, DataType.ascii(), keyType,
ImmutableMap.of("*", keyType), getSecondaryIndexKey(columnName, columnValue));
List<K> keys = new ArrayList<>();
if (keysResultSet.hasResults()) {
for (String key : keysResultSet.getColumnNames()) {
if (keyType == DataType.bigint()) {
keys.add((K) NumberUtils.createLong(key));
} else {
keys.add((K) key);
}
}
return keys;
}
return null;
}
示例4: getDataType
import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
private DataType getDataType() {
int i = random.nextInt(3);
switch (i) {
case 0: return DataType.ascii();
case 1: return DataType.bigint();
}
return null;
}
示例5: BigintCodec
import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
private BigintCodec() {
super(DataType.bigint());
}
示例6: BigDecimalToBigintCodec
import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
public BigDecimalToBigintCodec(Class<BigDecimal> javaClass) {
super(DataType.bigint(), javaClass);
}
示例7: LongToIntCodec
import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
public LongToIntCodec(Class<Integer> javaClass) {
super(DataType.bigint(), javaClass);
}
示例8: getRelDataType
import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
RelProtoDataType getRelDataType(String columnFamily, boolean view) {
List<ColumnMetadata> columns;
if (view) {
columns = getKeyspace().getMaterializedView(columnFamily).getColumns();
} else {
columns = getKeyspace().getTable(columnFamily).getColumns();
}
// Temporary type factory, just for the duration of this method. Allowable
// because we're creating a proto-type, not a type; before being used, the
// proto-type will be copied into a real type factory.
final RelDataTypeFactory typeFactory =
new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
final RelDataTypeFactory.Builder fieldInfo = typeFactory.builder();
for (ColumnMetadata column : columns) {
final String columnName = column.getName();
final DataType type = column.getType();
// TODO: This mapping of types can be done much better
SqlTypeName typeName = SqlTypeName.ANY;
if (type == DataType.uuid() || type == DataType.timeuuid()) {
// We currently rely on this in CassandraFilter to detect UUID columns.
// That is, these fixed length literals should be unquoted in CQL.
typeName = SqlTypeName.CHAR;
} else if (type == DataType.ascii() || type == DataType.text()
|| type == DataType.varchar()) {
typeName = SqlTypeName.VARCHAR;
} else if (type == DataType.cint() || type == DataType.varint()) {
typeName = SqlTypeName.INTEGER;
} else if (type == DataType.bigint()) {
typeName = SqlTypeName.BIGINT;
} else if (type == DataType.cdouble() || type == DataType.cfloat()
|| type == DataType.decimal()) {
typeName = SqlTypeName.DOUBLE;
}
fieldInfo.add(columnName, typeFactory.createSqlType(typeName)).nullable(true);
}
return RelDataTypeImpl.proto(fieldInfo.build());
}
示例9: getHecubaClientManager
import com.datastax.driver.core.DataType; //導入方法依賴的package包/類
public HecubaClientManager<Long> getHecubaClientManager(CassandraParamsBean params) {
return new DataStaxBasedHecubaClientManager<>(params, DataType.bigint());
}