Search in sources :

Example 1 with MutableCodecRegistry

use of com.datastax.oss.driver.api.core.type.codec.registry.MutableCodecRegistry in project zipkin by openzipkin.

the class DefaultSessionFactory method initializeUDTs.

static void initializeUDTs(CqlSession session, String keyspace) {
    KeyspaceMetadata ks = session.getMetadata().getKeyspace(keyspace).get();
    MutableCodecRegistry codecRegistry = (MutableCodecRegistry) session.getContext().getCodecRegistry();
    TypeCodec<UdtValue> annotationUDTCodec = codecRegistry.codecFor(ks.getUserDefinedType("annotation").get());
    codecRegistry.register(new AnnotationCodec(annotationUDTCodec));
    LOG.debug("Registering endpoint and annotation UDTs to keyspace {}", keyspace);
    TypeCodec<UdtValue> endpointUDTCodec = codecRegistry.codecFor(ks.getUserDefinedType("endpoint").get());
    codecRegistry.register(new EndpointCodec(endpointUDTCodec));
}
Also used : UdtValue(com.datastax.oss.driver.api.core.data.UdtValue) MutableCodecRegistry(com.datastax.oss.driver.api.core.type.codec.registry.MutableCodecRegistry) KeyspaceMetadata(com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata)

Aggregations

UdtValue (com.datastax.oss.driver.api.core.data.UdtValue)1 KeyspaceMetadata (com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata)1 MutableCodecRegistry (com.datastax.oss.driver.api.core.type.codec.registry.MutableCodecRegistry)1