diff options
author | Jakob Odersky <jakob@driver.xyz> | 2017-11-19 23:29:03 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@driver.xyz> | 2017-11-20 00:07:42 -0800 |
commit | b872ee2649c7b56df413fbde746ee68312c17abd (patch) | |
tree | 34b5fc63cc425a27969c73354fd7a2071ea67ba3 /src/main/scala/xyz/driver/core/json.scala | |
parent | 871e25f5e5ba23ca9202009d49fb38386558edd9 (diff) | |
download | driver-core-b872ee2649c7b56df413fbde746ee68312c17abd.tar.gz driver-core-b872ee2649c7b56df413fbde746ee68312c17abd.tar.bz2 driver-core-b872ee2649c7b56df413fbde746ee68312c17abd.zip |
Apply new formatting
Diffstat (limited to 'src/main/scala/xyz/driver/core/json.scala')
-rw-r--r-- | src/main/scala/xyz/driver/core/json.scala | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/scala/xyz/driver/core/json.scala b/src/main/scala/xyz/driver/core/json.scala index 6b27a9c..313849c 100644 --- a/src/main/scala/xyz/driver/core/json.scala +++ b/src/main/scala/xyz/driver/core/json.scala @@ -168,9 +168,10 @@ object json { } } - class GadtJsonFormat[T: TypeTag](typeField: String, - typeValue: PartialFunction[T, String], - jsonFormat: PartialFunction[String, JsonFormat[_ <: T]]) + class GadtJsonFormat[T: TypeTag]( + typeField: String, + typeValue: PartialFunction[T, String], + jsonFormat: PartialFunction[String, JsonFormat[_ <: T]]) extends RootJsonFormat[T] { def write(value: T): JsValue = { @@ -210,7 +211,7 @@ object json { object GadtJsonFormat { def create[T: TypeTag](typeField: String)(typeValue: PartialFunction[T, String])( - jsonFormat: PartialFunction[String, JsonFormat[_ <: T]]) = { + jsonFormat: PartialFunction[String, JsonFormat[_ <: T]]) = { new GadtJsonFormat[T](typeField, typeValue, jsonFormat) } @@ -221,8 +222,9 @@ object json { * * @see https://github.com/fthomas/refined */ - implicit def refinedJsonFormat[T, Predicate](implicit valueFormat: JsonFormat[T], - validate: Validate[T, Predicate]): JsonFormat[Refined[T, Predicate]] = + implicit def refinedJsonFormat[T, Predicate]( + implicit valueFormat: JsonFormat[T], + validate: Validate[T, Predicate]): JsonFormat[Refined[T, Predicate]] = new JsonFormat[Refined[T, Predicate]] { def write(x: T Refined Predicate): JsValue = valueFormat.write(x.value) def read(value: JsValue): T Refined Predicate = { |