All Versions
Latest Version
Avg Release Cycle
113 days
Latest Release
2941 days ago

Changelog History

  • v0.11.0-M2

    June 01, 2016
  • v0.11.0-M1

    April 02, 2016
  • v0.10.1._2.11 Changes

    May 15, 2015

    ๐Ÿ‘Œ Improvements

    ๐Ÿ›  Fixes

    • ๐Ÿ›  Fixes pickling of Java objects. See below
    • ๐Ÿ›  Fixes unpickling of sealed trait in Array. #294 by @jsuereth
    • ๐Ÿ›  Fixes unpickling of val whose implementation accesses a field. #328 by @phaller

    โ†ช Java Pickling workaround

    0๏ธโƒฃ Scala Pickling by default uses compile-time type information
    to automatically generate a pickler for a given type.
    For Java types, Pickling tries to guess the list of fields,
    and it often guesses incorrectly. #60, #263

    โ†ช Pickling 0.10.1 adds a workaround by stopping to
    compile when it detects an empty pickler. #295 by @eed3si9n

  • v0.10.0-M4

    February 04, 2015
  • v0.10.0-M3

    February 03, 2015
  • v0.10.0-M1

    January 21, 2015
  • v0.10.0._2.11 Changes

    February 06, 2015

    ๐Ÿš€ This is the first stable release of Scala Pickling, an automatic serialization framework made for Scala.
    ๐Ÿ†“ It's fast, boilerplate-free, and allows users to easily swap in/out different serialization formats (such as binary, or JSON). We will retain binary compatibility throughout the 0.10.x series. We'll also keep format compatibility during 0.10.x.

    Pickling in a nutshell

    To pickle a value, let's say Person("foo", 20), you need two things.
    A pickler combinator for the given type Person, and a pickle format.
    The Pickler[A] is responsible for breaking A down to abstract entries, fields, and collections.
    It's called a combinator, because complex pickler combinators can be composed from primitive picklers.
    The PickleFormat turns the abstract notions like fields into binary or text representation.

    0๏ธโƒฃ Defaults mode

    0๏ธโƒฃ Here's a basic usage using Defaults mode.

    scala> import scala.pickling.Defaults._, scala.pickling.json._
    scala> case class Person(name: String, age: Int)
    scala> val pkl = Person("foo", 20).pickle
    pkl: pickling.json.pickleFormat.PickleType =
      "$type": "Person",
      "name": "foo",
      "age": 20
    scala> val person = pkl.unpickle[Person]
    person: Person = Person(foo,20)

    0๏ธโƒฃ The Defaults mode automatically derives Pickler[Person] from the primitive picklers at compile-time!
    Because the code is statically generated, we can inline the string manipulations and make it fast.
    (Faster than Java serialization or Kryo, which also does not require schema)

    Note, because Pickler[A] is a typeclass, Pickling can be retrofitted to Person
    ๐Ÿ“„ without modifying the class to inherit Serializable or something like that.

    DIY protocol stack

    Pickling 0.10.0 offers picklers, ops, and formats as traits, which can be
    stacked together, so third-party libraries can provide custom modes.
    Suppose you only want to pickle primitive types and Apple, and don't want to automatically
    derive pickler combinators. Here's a custom mode:

    scala> case class Apple(kind: String)
    scala> val appleProtocol = {
             import scala.pickling._
             new pickler.PrimitivePicklers with pickler.RefPicklers
                 with json.JsonFormats {
               // Manually generate pickler for Apple
               implicit val applePickler = PicklerUnpickler.generate[Apple]
               // Don't fall back to runtime picklers
               implicit val so = static.StaticOnly
               // Provide custom functions
               def toJsonString[A: Pickler](a: A): String =
               def fromJsonString[A: Unpickler](s: String): A =
    scala> import appleProtocol._
    scala> toJsonString(Apple("honeycrisp"))
    res0: String =
      "$type": "Apple",
      "kind": "honeycrisp"

    ๐Ÿ‘€ For more details see Pickling.

  • v0.9.1._2.11

    November 17, 2014