List of usage examples for org.apache.cassandra.db.marshal ListType getInstance
public static <T> ListType<T> getInstance(AbstractType<T> elements, boolean isMultiCell)
From source file:com.impetus.client.cassandra.schemamanager.CassandraValidationClassMapper.java
License:Apache License
/** * Gets the value type name.// w ww . j a v a2s.c o m * * @param dataType * the data type * @param genericClasses * the generic classes * @param isCql3Enabled * the is cql3 enabled * @return the value type name * @throws SyntaxException * the syntax exception * @throws ConfigurationException * the configuration exception * @throws IllegalArgumentException * the illegal argument exception * @throws IllegalAccessException * the illegal access exception * @throws NoSuchFieldException * the no such field exception * @throws SecurityException * the security exception */ public static String getValueTypeName(Class<?> dataType, List<Class<?>> genericClasses, boolean isCql3Enabled) throws SyntaxException, ConfigurationException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { String valueType; Class<?> validation_class = getValidationClassInstance(dataType, isCql3Enabled); valueType = validation_class.toString(); if (validation_class.equals(ListType.class)) { TypeParser parser = new TypeParser(getValidationClass(genericClasses.get(0), isCql3Enabled)); valueType = ListType.getInstance(parser.parse(), true).toString(); } else if (validation_class.equals(SetType.class)) { TypeParser parser = new TypeParser(getValidationClass(genericClasses.get(0), isCql3Enabled)); valueType = SetType.getInstance(parser.parse(), true).toString(); } else if (validation_class.equals(MapType.class)) { Class keyClass = CassandraValidationClassMapper.getValidationClassInstance(genericClasses.get(0), true); Class valueClass = CassandraValidationClassMapper.getValidationClassInstance(genericClasses.get(1), true); Object keyClassInstance = keyClass.getDeclaredField("instance").get(null); Object valueClassInstance = valueClass.getDeclaredField("instance").get(null); valueType = MapType .getInstance((AbstractType) keyClassInstance, (AbstractType) valueClassInstance, true) .toString(); // TypeParser keyParser = new // TypeParser(getValidationClass(genericClasses.get(0), // isCql3Enabled)); // TypeParser valueParser = new // TypeParser(getValidationClass(genericClasses.get(1), // isCql3Enabled)); // valueType = MapType.getInstance(keyParser, // valueParser).toString(); } return valueType; }
From source file:com.stratio.cassandra.lucene.schema.mapping.MapperTest.java
License:Apache License
@Test public void testSupportsList() { testSupports(true, ListType.getInstance(UTF8Type.instance, false), UTF8Type.instance); }
From source file:com.stratio.cassandra.lucene.schema.mapping.MapperTest.java
License:Apache License
@Test public void testSupportsListMultiCell() { testSupports(true, ListType.getInstance(UTF8Type.instance, true), UTF8Type.instance); }
From source file:com.stratio.cassandra.lucene.schema.mapping.MapperTest.java
License:Apache License
@Test public void testSupportsListNot() { testSupports(false, ListType.getInstance(UTF8Type.instance, false), IntegerType.instance); }