@Override public ColumnDefinition setIndexWithType(String type) { this.columnDef.setIndex_type(IndexType.valueOf(type)); return this; }
@Override public ColumnDefinition setIndexWithType(String type) { this.columnDef.setIndex_type(IndexType.valueOf(type)); return this; }
@Override public ColumnDefinition setFields(Map<String, Object> options) { for (Entry<String, FieldMetadata> field : fieldsMetadata.entrySet()) { String fieldName = field.getKey(); if (options.containsKey(fieldName)) { if ("index_type".equals(fieldName)) { setFieldValue(field.getValue().getName(), IndexType.valueOf(options.get(fieldName).toString())); } else { setFieldValue(field.getValue().getName(), options.get(fieldName)); } } } return this; } }
@Override public ColumnDefinition setIndex(String name, String type) { this.columnDef.setIndex_name(name); this.columnDef.setIndex_type(IndexType.valueOf(type)); return this; }
/** * Getting IndexType object from indexType string * @param indexTypeAsString - string return by parser corresponding to IndexType * @return IndexType - an IndexType object */ private IndexType getIndexTypeFromString(String indexTypeAsString) { IndexType indexType; try { indexType = IndexType.findByValue(new Integer(indexTypeAsString)); } catch (NumberFormatException e) { try { // if this is not an integer lets try to get IndexType by name indexType = IndexType.valueOf(indexTypeAsString); } catch (IllegalArgumentException ie) { throw new RuntimeException("IndexType '" + indexTypeAsString + "' is unsupported.", ie); } } if (indexType == null) { throw new RuntimeException("IndexType '" + indexTypeAsString + "' is unsupported."); } return indexType; }
@Override public ColumnDefinition setFields(Map<String, Object> options) { for (Entry<String, FieldMetadata> field : fieldsMetadata.entrySet()) { String fieldName = field.getKey(); if (options.containsKey(fieldName)) { if ("index_type".equals(fieldName)) { setFieldValue(field.getValue().getName(), IndexType.valueOf(options.get(fieldName).toString())); } else { setFieldValue(field.getValue().getName(), options.get(fieldName)); } } } return this; } }
@Override public ColumnDefinition setIndex(String name, String type) { this.columnDef.setIndex_name(name); this.columnDef.setIndex_type(IndexType.valueOf(type)); return this; }
cd.setIndex_type(org.apache.cassandra.thrift.IndexType.valueOf(matchedIndex.kind.name())); cd.setIndex_name(matchedIndex.name); Map<String, String> filteredOptions = Maps.filterKeys(matchedIndex.options,
cd.setIndex_type(org.apache.cassandra.thrift.IndexType.valueOf(matchedIndex.kind.name())); cd.setIndex_name(matchedIndex.name); Map<String, String> filteredOptions = Maps.filterKeys(matchedIndex.options,
public ColumnDef toThrift() { ColumnDef cd = new ColumnDef(); cd.setName(ByteBufferUtil.clone(name.bytes)); cd.setValidation_class(type.toString()); cd.setIndex_type(indexType == null ? null : org.apache.cassandra.thrift.IndexType.valueOf(indexType.name())); cd.setIndex_name(indexName == null ? null : indexName); cd.setIndex_options(indexOptions == null ? null : Maps.newHashMap(indexOptions)); return cd; }