diff options
Diffstat (limited to 'src/main/scala/spray/json/package.scala')
-rw-r--r-- | src/main/scala/spray/json/package.scala | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/main/scala/spray/json/package.scala b/src/main/scala/spray/json/package.scala index f79b99e..37d63c2 100644 --- a/src/main/scala/spray/json/package.scala +++ b/src/main/scala/spray/json/package.scala @@ -25,9 +25,14 @@ package object json { def jsonReader[T](implicit reader: JsonReader[T]) = reader def jsonWriter[T](implicit writer: JsonWriter[T]) = writer - - implicit def pimpAny[T](any: T) = new PimpedAny(any) - implicit def pimpString(string: String) = new PimpedString(string) + + implicit def enrichAny[T](any: T) = new RichAny(any) + implicit def enrichString(string: String) = new RichString(string) + + @deprecated("use enrichAny", "1.3.4") + def pimpAny[T](any: T) = new PimpedAny(any) + @deprecated("use enrichString", "1.3.4") + def pimpString(string: String) = new PimpedString(string) } package json { @@ -35,13 +40,26 @@ package json { case class DeserializationException(msg: String, cause: Throwable = null, fieldNames: List[String] = Nil) extends RuntimeException(msg, cause) class SerializationException(msg: String) extends RuntimeException(msg) + private[json] class RichAny[T](any: T) { + def toJson(implicit writer: JsonWriter[T]): JsValue = writer.write(any) + } + + private[json] class RichString(string: String) { + @deprecated("deprecated in favor of parseJson", "1.2.6") + def asJson: JsValue = parseJson + def parseJson: JsValue = JsonParser(string) + } + + @deprecated("use RichAny", "1.3.4") private[json] class PimpedAny[T](any: T) { def toJson(implicit writer: JsonWriter[T]): JsValue = writer.write(any) } + @deprecated("use RichString", "1.3.4") private[json] class PimpedString(string: String) { @deprecated("deprecated in favor of parseJson", "1.2.6") def asJson: JsValue = parseJson def parseJson: JsValue = JsonParser(string) } + } |