本文整理汇总了Java中com.datastax.driver.core.ColumnMetadata.getIndex方法的典型用法代码示例。如果您正苦于以下问题:Java ColumnMetadata.getIndex方法的具体用法?Java ColumnMetadata.getIndex怎么用?Java ColumnMetadata.getIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.datastax.driver.core.ColumnMetadata
的用法示例。
在下文中一共展示了ColumnMetadata.getIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildColumnHandle
import com.datastax.driver.core.ColumnMetadata; //导入方法依赖的package包/类
private CassandraColumnHandle buildColumnHandle(ColumnMetadata columnMeta, boolean partitionKey, boolean clusteringKey, int ordinalPosition, boolean hidden)
{
CassandraType cassandraType = CassandraType.getCassandraType(columnMeta.getType().getName());
List<CassandraType> typeArguments = null;
if (cassandraType != null && cassandraType.getTypeArgumentSize() > 0) {
List<DataType> typeArgs = columnMeta.getType().getTypeArguments();
switch (cassandraType.getTypeArgumentSize()) {
case 1:
typeArguments = ImmutableList.of(CassandraType.getCassandraType(typeArgs.get(0).getName()));
break;
case 2:
typeArguments = ImmutableList.of(CassandraType.getCassandraType(typeArgs.get(0).getName()), CassandraType.getCassandraType(typeArgs.get(1).getName()));
break;
default:
throw new IllegalArgumentException("Invalid type arguments: " + typeArgs);
}
}
boolean indexed = columnMeta.getIndex() != null;
return new CassandraColumnHandle(connectorId, columnMeta.getName(), ordinalPosition, cassandraType, typeArguments, partitionKey, clusteringKey, indexed, hidden);
}
示例2: addColumnsToTable
import com.datastax.driver.core.ColumnMetadata; //导入方法依赖的package包/类
/**
* Adds all columns of column family.
* @param table Teiid table
* @param columnFamily Column family
*/
private void addColumnsToTable(MetadataFactory factory, Table table, TableMetadata columnFamily) {
for (ColumnMetadata column : columnFamily.getColumns()){
Class<?> cqlTypeToJavaClass = column.getType().asJavaClass();
Class<?> teiidRuntimeTypeFromJavaClass = TypeFacility.getRuntimeType(cqlTypeToJavaClass);
String type = TypeFacility.getDataTypeName(teiidRuntimeTypeFromJavaClass);
if (column.getType().getName().equals(com.datastax.driver.core.DataType.Name.TIMESTAMP)) {
type = TypeFacility.RUNTIME_NAMES.TIMESTAMP;
} else if (column.getType().getName().equals(com.datastax.driver.core.DataType.Name.CUSTOM)
|| column.getType().getName().equals(com.datastax.driver.core.DataType.Name.BLOB)) {
type = TypeFacility.RUNTIME_NAMES.VARBINARY;
}
Column c = factory.addColumn(column.getName(), type, table);
c.setUpdatable(true);
if (column.getIndex() != null) {
c.setSearchType(SearchType.Searchable);
}
else {
c.setSearchType(SearchType.Unsearchable);
}
}
}
示例3: validateAdditionalFilters
import com.datastax.driver.core.ColumnMetadata; //导入方法依赖的package包/类
private void validateAdditionalFilters(TableMetadata tableMetadata) {
for (Map.Entry<String, Serializable> entry : additionalFilters.entrySet()) {
/* check if there's an index specified on the provided column */
ColumnMetadata columnMetadata = tableMetadata.getColumn(entry.getKey());
if (columnMetadata == null) {
throw new DeepNoSuchFieldException("No column with name " + entry.getKey() + " has been found on " +
"table " + this.catalog + "." + this.table);
}
if (columnMetadata.getIndex() == null) {
throw new DeepIndexNotFoundException("No index has been found on column " + columnMetadata.getName()
+ " on table " + this.catalog + "." + this.table);
}
}
}
示例4: getLuceneIndex
import com.datastax.driver.core.ColumnMetadata; //导入方法依赖的package包/类
/**
* Retrieve the column name for the lucene indexes. Null if there is no lucene index.
*
* @return Lucene index; null, if doesn't exist.
*/
private String getLuceneIndex() {
String indexName = "";
TableMetadata tableMetadata = config.fetchTableMetadata();
List<ColumnMetadata> columns = tableMetadata.getColumns();
for (ColumnMetadata column : columns) {
if (column.getIndex() != null) {
if (column.getIndex().isCustomIndex()) {
indexName = column.getName();
}
}
}
return indexName;
}