This trait defines implicits for the common Play Framework transformations on values. Namely:
- A Reads[W] to read from json
- A Writes[W] to write to json
- A PathBindable to convert to and from strings in the url pattern
- A QueryStringBindable to convert to and from url query parameters
To use this with, for instance, a case class that extends AnyVal, create a companion object
that extends this trait with V being the primitive type (e.g. String, Int) and W being the
wrapped type. Then make an implicit instance of ValueWrapper[V,W] within the companion
object, defining the appropriate wrap and unwrap methods.
This trait defines implicits for the common Play Framework transformations on values. Namely: - A
Reads[W]
to read from json - AWrites[W]
to write to json - APathBindable
to convert to and from strings in the url pattern - AQueryStringBindable
to convert to and from url query parametersTo use this with, for instance, a case class that extends AnyVal, create a companion object that extends this trait with V being the primitive type (e.g. String, Int) and W being the wrapped type. Then make an implicit instance of
ValueWrapper[V,W]
within the companion object, defining the appropriate wrap and unwrap methods.