public class SimpleDateCodec
extends com.datastax.driver.core.TypeCodec.PrimitiveIntCodec
TypeCodec that maps CQL dates to Java primitive ints,
representing the number of days since the Epoch.
This codec can serve as a replacement for the driver's built-in
date codec,
when application code prefers to deal with raw days than with
LocalDate instances.
Important: this codec cannot work with SimpleStatements!
If you try to insert CQL date values as ints in a SimpleStatement,
the insertion would succeed but the values wouldn't be properly encoded.
Always use PreparedStatements when using this codec.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| Modifier and Type | Field and Description |
|---|---|
static SimpleDateCodec |
instance |
| Constructor and Description |
|---|
SimpleDateCodec() |
| Modifier and Type | Method and Description |
|---|---|
int |
deserializeNoBoxing(ByteBuffer bytes,
com.datastax.driver.core.ProtocolVersion protocolVersion) |
String |
format(Integer value) |
Integer |
parse(String value) |
ByteBuffer |
serializeNoBoxing(int value,
com.datastax.driver.core.ProtocolVersion protocolVersion) |
deserialize, serializeaccepts, 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 static final SimpleDateCodec instance
public ByteBuffer serializeNoBoxing(int value, com.datastax.driver.core.ProtocolVersion protocolVersion)
serializeNoBoxing in class com.datastax.driver.core.TypeCodec.PrimitiveIntCodecpublic int deserializeNoBoxing(ByteBuffer bytes, com.datastax.driver.core.ProtocolVersion protocolVersion)
deserializeNoBoxing in class com.datastax.driver.core.TypeCodec.PrimitiveIntCodecpublic Integer parse(String value)
parse in class com.datastax.driver.core.TypeCodec<Integer>Copyright © 2012–2018. All rights reserved.