com.netflix.astyanax.serializers
Class DateSerializer

java.lang.Object
  extended by com.netflix.astyanax.serializers.AbstractSerializer<java.util.Date>
      extended by com.netflix.astyanax.serializers.DateSerializer
All Implemented Interfaces:
Serializer<java.util.Date>

public final class DateSerializer
extends AbstractSerializer<java.util.Date>

Converts bytes to Date and vice versa, by first converting the Date to or from a long which represents the specified number of milliseconds since the standard base time known as "the Unix epoch", that is January 1, 1970, 00:00:00 UTC.

See Also:
Date

Constructor Summary
DateSerializer()
           
 
Method Summary
 java.util.Date fromByteBuffer(java.nio.ByteBuffer bytes)
          Extract an object of type T from the bytes.
 java.nio.ByteBuffer fromString(java.lang.String str)
          Create a ByteBuffer by first parsing the type out of a string
static DateSerializer get()
           
 ComparatorType getComparatorType()
           
 java.nio.ByteBuffer getNext(java.nio.ByteBuffer byteBuffer)
          Return the byte buffer for the next value in sorted order for the matching comparator type.
 java.lang.String getString(java.nio.ByteBuffer byteBuffer)
           
 java.nio.ByteBuffer toByteBuffer(java.util.Date obj)
          Extract bytes from the obj of type T
 
Methods inherited from class com.netflix.astyanax.serializers.AbstractSerializer
computeInitialHashSize, fromBytes, fromBytesList, fromBytesMap, fromBytesSet, toBytes, toBytesList, toBytesList, toBytesList, toBytesMap, toBytesSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateSerializer

public DateSerializer()
Method Detail

get

public static DateSerializer get()

toByteBuffer

public java.nio.ByteBuffer toByteBuffer(java.util.Date obj)
Description copied from interface: Serializer
Extract bytes from the obj of type T

Specified by:
toByteBuffer in interface Serializer<java.util.Date>
Specified by:
toByteBuffer in class AbstractSerializer<java.util.Date>
Returns:

fromByteBuffer

public java.util.Date fromByteBuffer(java.nio.ByteBuffer bytes)
Description copied from interface: Serializer
Extract an object of type T from the bytes.

Specified by:
fromByteBuffer in interface Serializer<java.util.Date>
Specified by:
fromByteBuffer in class AbstractSerializer<java.util.Date>
Returns:

fromString

public java.nio.ByteBuffer fromString(java.lang.String str)
Description copied from interface: Serializer
Create a ByteBuffer by first parsing the type out of a string

Specified by:
fromString in interface Serializer<java.util.Date>
Overrides:
fromString in class AbstractSerializer<java.util.Date>
Returns:

getString

public java.lang.String getString(java.nio.ByteBuffer byteBuffer)
Specified by:
getString in interface Serializer<java.util.Date>
Overrides:
getString in class AbstractSerializer<java.util.Date>

getNext

public java.nio.ByteBuffer getNext(java.nio.ByteBuffer byteBuffer)
Description copied from interface: Serializer
Return the byte buffer for the next value in sorted order for the matching comparator type. This is used for paginating columns.

Specified by:
getNext in interface Serializer<java.util.Date>
Overrides:
getNext in class AbstractSerializer<java.util.Date>
Returns:

getComparatorType

public ComparatorType getComparatorType()
Specified by:
getComparatorType in interface Serializer<java.util.Date>
Overrides:
getComparatorType in class AbstractSerializer<java.util.Date>