private <T> TypeCodec<T> createCodec(DataType cqlType, T value) { TypeCodec<T> codec = maybeCreateCodec(cqlType, value); if (codec == null) throw notFound(cqlType, TypeToken.of(value.getClass())); // double-check that the created codec satisfies the initial request if ((cqlType != null && !codec.accepts(cqlType)) || !codec.accepts(value)) throw notFound(cqlType, TypeToken.of(value.getClass())); logger.trace("Codec created: {}", codec); return codec; }
private <T> TypeCodec<T> createCodec(DataType cqlType, TypeToken<T> javaType) { TypeCodec<T> codec = maybeCreateCodec(cqlType, javaType); if (codec == null) throw notFound(cqlType, javaType); // double-check that the created codec satisfies the initial request // this check can fail specially when creating codecs for collections // e.g. if B extends A and there is a codec registered for A and // we request a codec for List<B>, the registry would generate a codec for List<A> if (!codec.accepts(cqlType) || (javaType != null && !codec.accepts(javaType))) throw notFound(cqlType, javaType); logger.trace("Codec created: {}", codec); return codec; }
private <T> TypeCodec<T> createCodec(DataType cqlType, T value) { TypeCodec<T> codec = maybeCreateCodec(cqlType, value); if (codec == null) throw notFound(cqlType, TypeToken.of(value.getClass())); // double-check that the created codec satisfies the initial request if ((cqlType != null && !codec.accepts(cqlType)) || !codec.accepts(value)) throw notFound(cqlType, TypeToken.of(value.getClass())); logger.trace("Codec created: {}", codec); return codec; }
private <T> TypeCodec<T> createCodec(DataType cqlType, TypeToken<T> javaType) { TypeCodec<T> codec = maybeCreateCodec(cqlType, javaType); if (codec == null) throw notFound(cqlType, javaType); // double-check that the created codec satisfies the initial request // this check can fail specially when creating codecs for collections // e.g. if B extends A and there is a codec registered for A and // we request a codec for List<B>, the registry would generate a codec for List<A> if (!codec.accepts(cqlType) || (javaType != null && !codec.accepts(javaType))) throw notFound(cqlType, javaType); logger.trace("Codec created: {}", codec); return codec; }
private <T> TypeCodec<T> createCodec(DataType cqlType, T value) { TypeCodec<T> codec = maybeCreateCodec(cqlType, value); if (codec == null) throw notFound(cqlType, TypeToken.of(value.getClass())); // double-check that the created codec satisfies the initial request if ((cqlType != null && !codec.accepts(cqlType)) || !codec.accepts(value)) throw notFound(cqlType, TypeToken.of(value.getClass())); logger.trace("Codec created: {}", codec); return codec; }
private <T> TypeCodec<T> createCodec(DataType cqlType, T value) { TypeCodec<T> codec = maybeCreateCodec(cqlType, value); if (codec == null) throw notFound(cqlType, TypeToken.of(value.getClass())); // double-check that the created codec satisfies the initial request if ((cqlType != null && !codec.accepts(cqlType)) || !codec.accepts(value)) throw notFound(cqlType, TypeToken.of(value.getClass())); logger.trace("Codec created: {}", codec); return codec; }
private <T> TypeCodec<T> createCodec(DataType cqlType, TypeToken<T> javaType) { TypeCodec<T> codec = maybeCreateCodec(cqlType, javaType); if (codec == null) throw notFound(cqlType, javaType); // double-check that the created codec satisfies the initial request // this check can fail specially when creating codecs for collections // e.g. if B extends A and there is a codec registered for A and // we request a codec for List<B>, the registry would generate a codec for List<A> if (!codec.accepts(cqlType) || (javaType != null && !codec.accepts(javaType))) throw notFound(cqlType, javaType); logger.trace("Codec created: {}", codec); return codec; }
private <T> TypeCodec<T> createCodec(DataType cqlType, TypeToken<T> javaType) { TypeCodec<T> codec = maybeCreateCodec(cqlType, javaType); if (codec == null) throw notFound(cqlType, javaType); // double-check that the created codec satisfies the initial request // this check can fail specially when creating codecs for collections // e.g. if B extends A and there is a codec registered for A and // we request a codec for List<B>, the registry would generate a codec for List<A> if (!codec.accepts(cqlType) || (javaType != null && !codec.accepts(javaType))) throw notFound(cqlType, javaType); logger.trace("Codec created: {}", codec); return codec; }