diff --git a/modules/core/src/main/scala-2.12-/tethys/readers/instances/LiteralReaders.scala b/modules/core/src/main/scala-2.12-/tethys/readers/instances/LiteralReaders.scala new file mode 100644 index 00000000..dcb60537 --- /dev/null +++ b/modules/core/src/main/scala-2.12-/tethys/readers/instances/LiteralReaders.scala @@ -0,0 +1,3 @@ +package tethys.readers.instances + +private[tethys] trait LiteralReaders diff --git a/modules/core/src/main/scala-2.12-/tethys/writers/instances/LiteralWriters.scala b/modules/core/src/main/scala-2.12-/tethys/writers/instances/LiteralWriters.scala new file mode 100644 index 00000000..a0a9fe9c --- /dev/null +++ b/modules/core/src/main/scala-2.12-/tethys/writers/instances/LiteralWriters.scala @@ -0,0 +1,3 @@ +package tethys.writers.instances + +private[tethys] trait LiteralWriters diff --git a/modules/core/src/main/scala-2.13+/tethys/readers/instances/LiteralReaders.scala b/modules/core/src/main/scala-2.13+/tethys/readers/instances/LiteralReaders.scala new file mode 100644 index 00000000..cb5175dd --- /dev/null +++ b/modules/core/src/main/scala-2.13+/tethys/readers/instances/LiteralReaders.scala @@ -0,0 +1,17 @@ +package tethys.readers.instances + +private[tethys] trait LiteralReaders { + implicit def booleanLiteralReader[L <: Boolean](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def stringLiteralReader[L <: String](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def shortLiteralReader[L <: Short](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def intLiteralReader[L <: Int](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def longLiteralReader[L <: Long](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def floatLiteralReader[L <: Float](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def doubleLiteralReader[L <: Double](implicit L: ValueOf[L]): JsonReader[L] = ??? +} diff --git a/modules/core/src/main/scala-2.13+/tethys/writers/instances/LiteralWriters.scala b/modules/core/src/main/scala-2.13+/tethys/writers/instances/LiteralWriters.scala new file mode 100644 index 00000000..57de1ec5 --- /dev/null +++ b/modules/core/src/main/scala-2.13+/tethys/writers/instances/LiteralWriters.scala @@ -0,0 +1,17 @@ +package tethys.writers.instances + +private[tethys] trait LiteralWriters { + implicit def booleanLiteralReader[L <: Boolean](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def stringLiteralReader[L <: String](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def shortLiteralReader[L <: Short](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def intLiteralReader[L <: Int](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def longLiteralReader[L <: Long](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def floatLiteralReader[L <: Float](implicit L: ValueOf[L]): JsonReader[L] = ??? + + implicit def doubleLiteralReader[L <: Double](implicit L: ValueOf[L]): JsonReader[L] = ??? +} diff --git a/modules/core/src/main/scala/tethys/readers/instances/AllJsonReaders.scala b/modules/core/src/main/scala/tethys/readers/instances/AllJsonReaders.scala index 61163878..ec235c24 100644 --- a/modules/core/src/main/scala/tethys/readers/instances/AllJsonReaders.scala +++ b/modules/core/src/main/scala/tethys/readers/instances/AllJsonReaders.scala @@ -4,7 +4,7 @@ import tethys.JsonReader import tethys.readers.tokens.TokenIterator import tethys.readers.{FieldName, ReaderError} -trait AllJsonReaders extends OptionReaders { +trait AllJsonReaders extends LiteralReaders with OptionReaders { implicit lazy val booleanReader: JsonReader[Boolean] = new JsonReader[Boolean] { override def read(it: TokenIterator)(implicit fieldName: FieldName): Boolean = { if(it.currentToken().isBooleanValue) { diff --git a/modules/core/src/main/scala/tethys/writers/instances/AllJsonWriters.scala b/modules/core/src/main/scala/tethys/writers/instances/AllJsonWriters.scala index b9373ee0..e749e5c8 100644 --- a/modules/core/src/main/scala/tethys/writers/instances/AllJsonWriters.scala +++ b/modules/core/src/main/scala/tethys/writers/instances/AllJsonWriters.scala @@ -3,7 +3,7 @@ package tethys.writers.instances import tethys.JsonWriter import tethys.writers.tokens.TokenWriter -trait AllJsonWriters extends OptionWriters { +trait AllJsonWriters extends LiteralWriters with OptionWriters { implicit lazy val intWriter: JsonWriter[Int] = new JsonWriter[Int] { override def write(value: Int, tokenWriter: TokenWriter): Unit = tokenWriter.writeNumber(value) }