T - The type of POJO represented by this codecpublic class UDTCodecImpl<T>
extends com.datastax.driver.core.TypeCodec<T>
UDTCodecImpl class provides a suitable codec for UDT types
based on a given class info.com.datastax.driver.core.TypeCodec.AbstractCollectionCodec<E,C extends Collection<E>>, com.datastax.driver.core.TypeCodec.AbstractMapCodec<K,V>, com.datastax.driver.core.TypeCodec.AbstractTupleCodec<T>, com.datastax.driver.core.TypeCodec.AbstractUDTCodec<T>, com.datastax.driver.core.TypeCodec.PrimitiveBooleanCodec, com.datastax.driver.core.TypeCodec.PrimitiveByteCodec, com.datastax.driver.core.TypeCodec.PrimitiveDoubleCodec, com.datastax.driver.core.TypeCodec.PrimitiveFloatCodec, com.datastax.driver.core.TypeCodec.PrimitiveIntCodec, com.datastax.driver.core.TypeCodec.PrimitiveLongCodec, com.datastax.driver.core.TypeCodec.PrimitiveShortCodec| Constructor and Description |
|---|
UDTCodecImpl(UDTClassInfoImpl<T> cinfo,
String keyspace)
Instantiates a new default
UDTCodecImpl object. |
UDTCodecImpl(UDTClassInfoImpl<T> cinfo,
com.datastax.driver.core.UserType definition)
Instantiates a new
UDTCodecImpl object. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
deregister(com.datastax.driver.core.UserType definition)
Deregisters the current definition from this codec as it was removed from
the cluster.
|
T |
deserialize(ByteBuffer bytes,
com.datastax.driver.core.ProtocolVersion protocolVersion) |
String |
format(T value) |
protected com.datastax.driver.core.UserType |
getUserType()
Gets the user type for this codec.
|
T |
parse(String value) |
protected void |
register(com.datastax.driver.core.UserType definition)
Registers a new cluster-defined definition for the user type being decoded
by this codec.
|
ByteBuffer |
serialize(T value,
com.datastax.driver.core.ProtocolVersion protocolVersion) |
accepts, accepts, accepts, accepts, ascii, bigint, blob, cboolean, cdouble, cfloat, cint, counter, custom, date, decimal, getCqlType, getJavaType, inet, list, map, set, smallInt, time, timestamp, timeUUID, tinyInt, toString, tuple, userType, uuid, varchar, varintpublic UDTCodecImpl(UDTClassInfoImpl<T> cinfo, String keyspace)
UDTCodecImpl object.cinfo - the udt class infokeyspace - the keyspace for which to create a codecpublic UDTCodecImpl(UDTClassInfoImpl<T> cinfo, com.datastax.driver.core.UserType definition)
UDTCodecImpl object.cinfo - the udt class infodefinition - the registered user type definition to use when decodingprotected com.datastax.driver.core.UserType getUserType()
protected void register(com.datastax.driver.core.UserType definition)
definition - the new definition for the user type to registerIllegalArgumentException - if the definition doesn't correspond to
this oneprotected void deregister(com.datastax.driver.core.UserType definition)
definition - the definition for the user type to deregisterIllegalArgumentException - if the definition doesn't correspond to
this onepublic T parse(String value) throws com.datastax.driver.core.exceptions.InvalidTypeException
parse in class com.datastax.driver.core.TypeCodec<T>com.datastax.driver.core.exceptions.InvalidTypeExceptionTypeCodec.parse(java.lang.String)public String format(T value) throws com.datastax.driver.core.exceptions.InvalidTypeException
format in class com.datastax.driver.core.TypeCodec<T>com.datastax.driver.core.exceptions.InvalidTypeExceptionTypeCodec.format(java.lang.Object)public ByteBuffer serialize(T value, com.datastax.driver.core.ProtocolVersion protocolVersion) throws com.datastax.driver.core.exceptions.InvalidTypeException
serialize in class com.datastax.driver.core.TypeCodec<T>com.datastax.driver.core.exceptions.InvalidTypeExceptionTypeCodec.serialize(java.lang.Object, com.datastax.driver.core.ProtocolVersion)public T deserialize(ByteBuffer bytes, com.datastax.driver.core.ProtocolVersion protocolVersion) throws com.datastax.driver.core.exceptions.InvalidTypeException
deserialize in class com.datastax.driver.core.TypeCodec<T>com.datastax.driver.core.exceptions.InvalidTypeExceptionTypeCodec.deserialize(java.nio.ByteBuffer, com.datastax.driver.core.ProtocolVersion)Copyright (C) 2015-2017 The Helenus Driver Project Authors.