Created
February 11, 2013 19:05
-
-
Save vikraman/4756717 to your computer and use it in GitHub Desktop.
org.joda.time.DateTime serializer for titan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example | |
import java.nio.ByteBuffer | |
import org.joda.time.DateTime | |
import com.thinkaurelius.titan.core.AttributeSerializer | |
class DateTimeSerializer extends AttributeSerializer[DateTime] { | |
private val serialVersionUID = 272513079663L | |
def read(buffer: ByteBuffer): DateTime = | |
new DateTime(buffer.getLong() + Long.MinValue) | |
def writeObjectData(buffer: ByteBuffer, obj: DateTime): Unit = | |
buffer.putLong(obj.getMillis - Long.MinValue) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment