public class InstantCodec extends com.datastax.driver.core.TypeCodec<Instant>
TypeCodec that maps Instant to CQL timestamp
allowing the setting and retrieval of timestamp
columns as Instant instances.
Since C* timestamp columns do not preserve timezones
any attached timezone information will be lost.
IMPORTANT: this codec's format method formats
timestamps using an ISO-8601 format that includes milliseconds.
This format is incompatible with Cassandra versions < 2.0.9.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 InstantCodec |
instance |
| Modifier and Type | Method and Description |
|---|---|
Instant |
deserialize(ByteBuffer bytes,
com.datastax.driver.core.ProtocolVersion protocolVersion) |
String |
format(Instant value) |
Instant |
parse(String value) |
ByteBuffer |
serialize(Instant 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 static final InstantCodec instance
public ByteBuffer serialize(Instant value, com.datastax.driver.core.ProtocolVersion protocolVersion)
serialize in class com.datastax.driver.core.TypeCodec<Instant>public Instant deserialize(ByteBuffer bytes, com.datastax.driver.core.ProtocolVersion protocolVersion)
deserialize in class com.datastax.driver.core.TypeCodec<Instant>public String format(Instant value)
format in class com.datastax.driver.core.TypeCodec<Instant>Copyright © 2012–2018. All rights reserved.