json - Scala Pickling for sql.Timestamp -
I am using
I Skla Pikling Library (0.9.0-snapshot) Jason Siriyllaijing.
serializing and like to write a custom Pickler and unpickler for deserializing sql.Timestamp areas such as common areas, I am able to order time stamp field by overriding pickle method Spickler, I also (string Is it possible for the timestamp field to be able to desrialize the time stamp value in json string?
I mean,
case class T1?
{"tpe": "T1", "Junk" and " Id ":" 42 "," name ":" name "," time ":" 2014-10-17 17: 19: 29.97 "}
It is possible, but the case class Unable to dismiss back
T1 (42, "name", new timestamp .. new date (getTime)) pickle.value.unpickle [T1]
// show error scala.MatchError: 2014-10-17 17: 19: 29.97 (class of java.lang.String)My current implementation looks like this
< Code> class TimestampPickler (built-in Val Format:. PickleFormat) extends The SPickler [timestamp] Unpickler [timestamp] {Private Val stringUnpickler = indirectly with [Unpickler [string]] override def pickles (picklee: Timestamp, builder: PBuilder): Unit = {builder.hintTag (FastTypeTag.String) .beginEntry (picklee.toString) .endEntry ()} def override unpickle (tag: = & gt; Fasttaiptag [_], R eader: PReader): Timestamp = {// todo}}
genTimestampPickler def contained (built-in format: PickleFormat) = new TimestampPickler
Comments
Post a Comment