Search in sources :

Example 51 with AbstractType

use of org.apache.cassandra.db.marshal.AbstractType in project brisk by riptano.

the class CassandraStorage method getValidatorMap.

private Map<ByteBuffer, AbstractType> getValidatorMap(CfDef cfDef) throws IOException {
    Map<ByteBuffer, AbstractType> validators = new HashMap<ByteBuffer, AbstractType>();
    for (ColumnDef cd : cfDef.column_metadata) {
        if (cd.getValidation_class() != null && !cd.getValidation_class().isEmpty()) {
            AbstractType validator = null;
            try {
                validator = TypeParser.parse(cd.getValidation_class());
                validators.put(cd.name, validator);
            } catch (ConfigurationException e) {
                throw new IOException(e);
            }
        }
    }
    return validators;
}
Also used : ConfigurationException(org.apache.cassandra.config.ConfigurationException) AbstractType(org.apache.cassandra.db.marshal.AbstractType) IOException(java.io.IOException) ByteBuffer(java.nio.ByteBuffer)

Aggregations

AbstractType (org.apache.cassandra.db.marshal.AbstractType)51 ByteBuffer (java.nio.ByteBuffer)20 ColumnMetadata (org.apache.cassandra.schema.ColumnMetadata)9 TableMetadata (org.apache.cassandra.schema.TableMetadata)8 List (java.util.List)6 Map (java.util.Map)6 CollectionType (org.apache.cassandra.db.marshal.CollectionType)6 CompositeType (org.apache.cassandra.db.marshal.CompositeType)6 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 Set (java.util.Set)5 Collectors (java.util.stream.Collectors)5 CQL3Type (org.apache.cassandra.cql3.CQL3Type)5 SerializationHeader (org.apache.cassandra.db.SerializationHeader)5 TupleType (org.apache.cassandra.db.marshal.TupleType)5 UserType (org.apache.cassandra.db.marshal.UserType)5 ColumnIdentifier (org.apache.cassandra.cql3.ColumnIdentifier)4 FieldIdentifier (org.apache.cassandra.cql3.FieldIdentifier)4 Test (org.junit.Test)4 AuditLogContext (org.apache.cassandra.audit.AuditLogContext)3