private static void initComparatorTypeMap() { Map<ComparatorType, String> tmpMap = new HashMap<ComparatorType, String>(); tmpMap.put(ComparatorType.ASCIITYPE, "ASCII"); tmpMap.put(ComparatorType.BYTESTYPE, "BLOB"); tmpMap.put(ComparatorType.BOOLEANTYPE, "BOOLEAN"); tmpMap.put(ComparatorType.COUNTERTYPE, "COUNTER"); tmpMap.put(ComparatorType.DECIMALTYPE, "DECIMAL"); tmpMap.put(ComparatorType.DOUBLETYPE, "DOUBLE"); tmpMap.put(ComparatorType.FLOATTYPE, "FLOAT"); tmpMap.put(ComparatorType.LONGTYPE, "BIGINT"); tmpMap.put(ComparatorType.INT32TYPE, "INT"); tmpMap.put(ComparatorType.UTF8TYPE, "TEXT"); tmpMap.put(ComparatorType.DATETYPE, "TIMESTAMP"); tmpMap.put(ComparatorType.UUIDTYPE, "UUID"); tmpMap.put(ComparatorType.INTEGERTYPE, "VARINT"); tmpMap.put(ComparatorType.TIMEUUIDTYPE, "TIMEUUID"); for (ComparatorType cType : tmpMap.keySet()) { String value = tmpMap.get(cType); comparatorToCql3Type.put(cType.getClassName(), value); comparatorToCql3Type.put(cType.getTypeName(), value); cqlToComparatorType.put(value, cType); } }
public static ComparatorType getByClassName(String className) { if (className == null) { return null; } for (ComparatorType type : ComparatorType.values()) { if (type.getClassName().equals(getShadedClassName(className))) { return type; } } return null; }
public CqlColumnFamilyDefinitionImpl(Session session, String keyspace, ColumnFamily<?, ?> columnFamily, Map<String, Object> options) { this.session = session; Preconditions.checkArgument(columnFamily != null, "ColumnFamily cannot be null"); if (options == null) { options = new HashMap<String, Object>(); } keyspaceName = keyspace; cfName = columnFamily.getName(); optionsMap.put("key_validator", columnFamily.getKeySerializer().getComparatorType().getClassName()); optionsMap.put("comparator", columnFamily.getColumnSerializer().getComparatorType().getClassName()); optionsMap.put("default_validator", columnFamily.getDefaultValueSerializer().getComparatorType().getClassName()); if (columnFamily.getColumnSerializer() instanceof AnnotatedCompositeSerializer) { compositeSerializer = (AnnotatedCompositeSerializer<?>) columnFamily.getColumnSerializer(); } initFromMap(options); }