com.paypal.cascade.json

Convertible

implicit class Convertible extends AnyRef

Implicit conversions from an arbitrary JSON object to a variety of object types.

import com.paypal.cascade.json._
case class JsonPatch(op: String, path: String, value: Option[Any])
case class AnObject(...)
val jsonStr = JsonPatch("add", "/-", Some(AnObject(...)))).toJson.get
val a = jsonStr.fromJson[JsonPatch].get
val inner = a.value.convertValue[Option[AnObject]].get
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Convertible
  2. AnyRef
  3. Any
Implicitly
  1. by Marshallable
  2. by Convertible
  3. by any2stringadd
  4. by any2stringfmt
  5. by any2ArrowAssoc
  6. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Convertible(convertMe: Any)

    convertMe

    this object

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from Convertible to StringAdd performed by method any2stringadd in scala.Predef.
    Definition Classes
    StringAdd
  5. def ->[B](y: B): (Convertible, B)

    Implicit information
    This member is added by an implicit conversion from Convertible to ArrowAssoc[Convertible] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def convertValue[T](implicit arg0: Manifest[T]): Try[T]

    Convert an arbitrary JSON object to a T, where T is some context bound type.

    Convert an arbitrary JSON object to a T, where T is some context bound type. Useful for secondary JSON conversion, e.g. for polymorphic data members. A direct use-case is in JSON-Patch, where the expected value may be any of a raw value (String, Int, etc.), a full JSON object, or nothing.

    T

    a context bound type

    returns

    a scala.util.Try that is either the object of type T, or a java.lang.IllegalArgumentException in the case of a cast to an incompatible type.

    Note

    Discovered via testing, this method does not play well with Optional data stored in Any fields. If you know that you need to serialize Optional values, please state them as Optional in their type declaration, e.g. in the example here with Foo and Bar. If a None is serialized in an object with an Any field, and you try to convert this as an Option, it will instead come out as a null value and you will have to post-process it as such. Instead, if the field is declared as a Option[Any] and a None is serialized, it will correctly be converted here as a None.

    ,

    This proxy method exists as an alternative to exposing the entire private mapper through a getInstance or copy method, so that the mapper remains a strict singleton and its configuration remains obscured. Otherwise, this is a direct proxy of the mapper.convertValue method from ScalaObjectMapper in Jackson, with added exception catching.

    ,

    In general, Unmarshallable.fromJson should be preferred for String-to-Object conversion. This method is intended for secondary conversion after Unmarshallable.fromJson has been applied.

  11. def ensuring(cond: (Convertible) ⇒ Boolean, msg: ⇒ Any): Convertible

    Implicit information
    This member is added by an implicit conversion from Convertible to Ensuring[Convertible] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: (Convertible) ⇒ Boolean): Convertible

    Implicit information
    This member is added by an implicit conversion from Convertible to Ensuring[Convertible] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: Boolean, msg: ⇒ Any): Convertible

    Implicit information
    This member is added by an implicit conversion from Convertible to Ensuring[Convertible] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: Boolean): Convertible

    Implicit information
    This member is added by an implicit conversion from Convertible to Ensuring[Convertible] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  17. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from Convertible to StringFormat performed by method any2stringfmt in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  19. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  20. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  21. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  22. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  26. def toJson: Try[String]

    Convert an object to a JSON string representation.

    Convert an object to a JSON string representation.

    returns

    a scala.util.Try that is either the JSON string representation, or a com.fasterxml.jackson.core.JsonProcessingException

    Implicit information
    This member is added by an implicit conversion from Convertible to Marshallable[Convertible] performed by method Marshallable in com.paypal.cascade.json.
    Definition Classes
    Marshallable
  27. def toString(): String

    Definition Classes
    AnyRef → Any
  28. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. def [B](y: B): (Convertible, B)

    Implicit information
    This member is added by an implicit conversion from Convertible to ArrowAssoc[Convertible] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. def convertValue[T](implicit arg0: Manifest[T]): Try[T]

    Convert an arbitrary JSON object to a T, where T is some context bound type.

    Convert an arbitrary JSON object to a T, where T is some context bound type. Useful for secondary JSON conversion, e.g. for polymorphic data members. A direct use-case is in JSON-Patch, where the expected value may be any of a raw value (String, Int, etc.), a full JSON object, or nothing.

    T

    a context bound type

    returns

    a scala.util.Try that is either the object of type T, or a java.lang.IllegalArgumentException in the case of a cast to an incompatible type.

    Implicit information
    This member is added by an implicit conversion from Convertible to Convertible performed by method Convertible in com.paypal.cascade.json.
    Shadowing
    This implicitly inherited member is shadowed by one or more members in this class.
    To access this member you can use a type ascription:
    (convertible: Convertible).convertValue(arg0)
    Note

    Discovered via testing, this method does not play well with Optional data stored in Any fields. If you know that you need to serialize Optional values, please state them as Optional in their type declaration, e.g. in the example here with Foo and Bar. If a None is serialized in an object with an Any field, and you try to convert this as an Option, it will instead come out as a null value and you will have to post-process it as such. Instead, if the field is declared as a Option[Any] and a None is serialized, it will correctly be converted here as a None.

    ,

    This proxy method exists as an alternative to exposing the entire private mapper through a getInstance or copy method, so that the mapper remains a strict singleton and its configuration remains obscured. Otherwise, this is a direct proxy of the mapper.convertValue method from ScalaObjectMapper in Jackson, with added exception catching.

    ,

    In general, Unmarshallable.fromJson should be preferred for String-to-Object conversion. This method is intended for secondary conversion after Unmarshallable.fromJson has been applied.

  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from Convertible to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (convertible: StringAdd).self
    Definition Classes
    StringAdd
  3. val self: Any

    Implicit information
    This member is added by an implicit conversion from Convertible to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (convertible: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def x: Convertible

    Implicit information
    This member is added by an implicit conversion from Convertible to ArrowAssoc[Convertible] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (convertible: ArrowAssoc[Convertible]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  2. def x: Convertible

    Implicit information
    This member is added by an implicit conversion from Convertible to Ensuring[Convertible] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (convertible: Ensuring[Convertible]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion Marshallable from Convertible to Marshallable[Convertible]

Inherited by implicit conversion Convertible from Convertible to Convertible

Inherited by implicit conversion any2stringadd from Convertible to StringAdd

Inherited by implicit conversion any2stringfmt from Convertible to StringFormat

Inherited by implicit conversion any2ArrowAssoc from Convertible to ArrowAssoc[Convertible]

Inherited by implicit conversion any2Ensuring from Convertible to Ensuring[Convertible]

Ungrouped