public class JacksonJsonCodec<T> extends TypeCodec<T>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>
TypeCodec.AbstractCollectionCodec<E,C extends Collection<E>>, TypeCodec.AbstractMapCodec<K,V>, TypeCodec.AbstractTupleCodec<T>, TypeCodec.AbstractUDTCodec<T>, TypeCodec.PrimitiveBooleanCodec, TypeCodec.PrimitiveByteCodec, TypeCodec.PrimitiveDoubleCodec, TypeCodec.PrimitiveFloatCodec, TypeCodec.PrimitiveIntCodec, TypeCodec.PrimitiveLongCodec, TypeCodec.PrimitiveShortCodec| Constructor and Description |
|---|
JacksonJsonCodec(Class<T> javaClass)
Creates a new instance for the provided
javaClass,
using a default, newly-allocated ObjectMapper. |
JacksonJsonCodec(Class<T> javaClass,
ObjectMapper objectMapper)
Creates a new instance for the provided
javaClass,
and using the provided ObjectMapper. |
JacksonJsonCodec(TypeToken<T> javaType)
Creates a new instance for the provided
javaType,
using a default, newly-allocated ObjectMapper. |
JacksonJsonCodec(TypeToken<T> javaType,
ObjectMapper objectMapper)
Creates a new instance for the provided
javaType,
and using the provided ObjectMapper. |
| Modifier and Type | Method and Description |
|---|---|
T |
deserialize(ByteBuffer bytes,
ProtocolVersion protocolVersion) |
String |
format(T value) |
T |
parse(String value) |
ByteBuffer |
serialize(T value,
ProtocolVersion protocolVersion) |
protected JavaType |
toJacksonJavaType()
|
accepts, accepts, accepts, accepts, ascii, bigint, blob, cboolean, cdouble, cfloat, cint, counter, custom, date, decimal, duration, getCqlType, getJavaType, inet, list, map, set, smallInt, time, timestamp, timeUUID, tinyInt, toString, tuple, userType, uuid, varchar, varintpublic JacksonJsonCodec(Class<T> javaClass)
javaClass,
using a default, newly-allocated ObjectMapper.javaClass - the Java class this codec maps to.public JacksonJsonCodec(TypeToken<T> javaType)
javaType,
using a default, newly-allocated ObjectMapper.javaType - the Java type this codec maps to.public JacksonJsonCodec(Class<T> javaClass, ObjectMapper objectMapper)
javaClass,
and using the provided ObjectMapper.javaClass - the Java class this codec maps to.public JacksonJsonCodec(TypeToken<T> javaType, ObjectMapper objectMapper)
javaType,
and using the provided ObjectMapper.javaType - the Java type this codec maps to.public ByteBuffer serialize(T value, ProtocolVersion protocolVersion) throws InvalidTypeException
serialize in class TypeCodec<T>InvalidTypeExceptionpublic T deserialize(ByteBuffer bytes, ProtocolVersion protocolVersion) throws InvalidTypeException
deserialize in class TypeCodec<T>InvalidTypeExceptionpublic String format(T value) throws InvalidTypeException
format in class TypeCodec<T>InvalidTypeExceptionpublic T parse(String value) throws InvalidTypeException
parse in class TypeCodec<T>InvalidTypeExceptionCopyright © 2012–2017. All rights reserved.