wg/jacks — pull request #12 by cunei (2013-03-19 14:34:31+00:00)
Title: Case classes and nulls /2

Hello Will,

Thank you for considering my pull request. The binary compatibility requirement is a good point; I am therefore submitting a modified version of the patch, which includes a simple optional configuration mechanism. The standard JacksMapper works exactly as it did before. However, it is now also possible to write:

```
import com.lambdaworks.jacks._
import JacksOption._

val m=JacksMapper.withOptions(CheckCaseClassNulls(true))
import m.{writeValueAsString,readValue}
```

Concerning its usefulness: in the common case in which a group of case classes are recursively deserialized from a hand-written JSON configuration file, for example, it is possible that the person writing the configuration file forgets one or more of the fields. In the absence of a library-supported option to automatically detect nulls, it is then upon the library client code to manually check that every individual field of every generated case class is not null. That, of course, adds a great deal of complexity to the user code (and makes it in turn error-prone).

I hope you will consider this pull request, or a variant, for inclusion (at least, it is crucial in my case). Thanks!