implicit.ly

Scala software, hot off the presses

« Back to blog

salat 0.0.7

Features new in Salat 0.0.7 include:

  • reorganization of Salat project into modules
  • base dependency is now salat-core 0.0.7
  • SalatDAO provides simple, extensible turnkey DAO pattern
  • insert, save and remove methods accept case classes
  • find returns an Iterable Mongo cursor typed to your case class - skip, limit, sort and get your objects no fuss no muss
  • query and get back a list of typed ids
  • projections return an Iterable Mongo cursor typed to a case class or a primitive
  • child collection support - find, update, remove, find ids and get back typed projections on children using a typed parent id or typed list of parent ids
  • new, more detailed documentation on our wiki
  • better error handling, including detailed explanations when graters and constructors misfire
  • More flexible @Key behavior to override field name when serializing objects
  • register global overrides at the context level
  • use @Key in a trait or an abstract superclass
  • Create a custom context to get more flexible type hinting
  • chose a type hinting strategy: always (default), only when necessary, or never (not recommended)
  • customize the type hint at the context level - replace "_typeHint" with whatever you like
  • Use @Persist to persist case class fields that are not declared in the constructor
  • works with var, val and lazy val defined inside case class
  • also works with fields defined in traits or abstract superclasses

Salat is a simple Scala serialization library that makes it easy to:

  • serialize a Scala case class to a MongoDB DBObject
  • deserialize a MongoDB DBObject back into an instance of the original case class

Documentation is available on the wiki.

Feature highlights:

  • Built to leverage 10gen's Casbah and its full suite of BSON encoders. Primitive values of types ranging from Double and Float to Joda Time's DateTime are supported seamlessly out of the box.
  • Works with nested case class instances of arbitrary depth. Support is provided for nested Seq-s and Map-s, whose values may be primitives or embedded case classes which will also be (de)serialized.
  • Supports Scala idioms such as Option-s and default argument values.
  • Only minimal use is made of Java reflection. Where feasible, Salat leverages Scala class signatures.

Salat is free software. Its availability is governed by the Apache 2 license. See LICENSE.md at source root for more information. Please make use of the GitHub project to report issues or contact the author.

Development supported by Novus Partners, Inc.