Packages

class ScalaObjectMapper extends AnyRef

Note

this API is inspired by the Jerkson Parser

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ScalaObjectMapper
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ScalaObjectMapper(underlying: JacksonScalaObjectMapperType)

    underlying

    a configured JacksonScalaObjectMapperType

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. def convert[T](any: Any)(implicit arg0: Manifest[T]): T

    Convenience method for doing two-step conversion from a given value, into an instance of a given type, T.

    Convenience method for doing two-step conversion from a given value, into an instance of a given type, T. This is functionality equivalent to first serializing the given value into JSON, then binding JSON data into a value of the given type, but may be executed without fully serializing into JSON. The same converters (serializers, deserializers) will be used for data binding, meaning the same object mapper configuration works.

    Note: when a com.twitter.util.jackson.caseclass.exceptions.CaseClassMappingException is thrown inside of the the ObjectMapper#convertValue method, Jackson wraps the exception inside of an IllegalArgumentException. As such we unwrap to restore the original exception here. The wrapping occurs because the com.twitter.util.jackson.caseclass.exceptions.CaseClassMappingException is a sub-type of java.io.IOException (through extension of com.fasterxml.jackson.databind.JsonMappingException --> com.fasterxml.jackson.core.JsonProcessingException --> java.io.IOException.

    T

    the type to which to be converted.

    any

    the value to be converted.

    returns

    a new instance of type T converted from the given Any type.

    See also

    https://github.com/FasterXML/jackson-databind/blob/d70b9e65c5e089094ec7583fa6a38b2f484a96da/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java#L2167

  7. def convert(from: Any, toValueType: JavaType): AnyRef

    Convenience method for doing two-step conversion from given value, into an instance of given value type, JavaType if (but only if!) conversion is needed.

    Convenience method for doing two-step conversion from given value, into an instance of given value type, JavaType if (but only if!) conversion is needed. If given value is already of requested type, the value is returned as is.

    This method is functionally similar to first serializing a given value into JSON, and then binding JSON data into a value of the given type, but should be more efficient since full serialization does not (need to) occur. However, the same converters (serializers, deserializers) will be used for data binding, meaning the same object mapper configuration works.

    Note: it is possible that in some cases behavior does differ from full serialize-then-deserialize cycle. It is not guaranteed, however, that the behavior is 100% the same -- the goal is just to allow efficient value conversions for structurally compatible Objects, according to standard Jackson configuration.

    Further note that this functionality is not designed to support "advanced" use cases, such as conversion of polymorphic values, or cases where Object Identity is used.

    from

    value from which to convert.

    toValueType

    type to be converted into.

    returns

    a new instance of type JavaType converted from the given Any type.

  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. def parse[T](jsonParser: JsonParser)(implicit arg0: Manifest[T]): T

    Read a value from a JsonParser into a type T.

  18. def parse[T](string: String)(implicit arg0: Manifest[T]): T

    Read a value from a String into a type T.

  19. def parse[T](bytes: Array[Byte])(implicit arg0: Manifest[T]): T

    Read a value from an Array[Byte] into a type T.

  20. def parse[T](inputStream: InputStream)(implicit arg0: Manifest[T]): T

    Read a value from an InputStream (caller is responsible for closing the stream) into a type T.

  21. def parse[T](jsonNode: JsonNode)(implicit arg0: Manifest[T]): T

    Convert from a JsonNode into a type T.

  22. def parse[T](byteBuffer: ByteBuffer)(implicit arg0: Manifest[T]): T

    Read a value from a ByteBuffer into a type T.

  23. def parse[T](buf: Buf)(implicit arg0: Manifest[T]): T

    Read a value from a Buf into a type T.

  24. lazy val prettyObjectMapper: ObjectWriter

    Constructed ObjectWriter that will serialize objects using specified pretty printer for indentation (or if null, no pretty printer).

  25. def propertyNamingStrategy: PropertyNamingStrategy

    Returns the currently configured PropertyNamingStrategy

  26. def reader[T](implicit arg0: Manifest[T]): ObjectReader

    Factory method for constructing a com.fasterxml.jackson.databind.ObjectReader that will read or update instances of specified type, T.

    Factory method for constructing a com.fasterxml.jackson.databind.ObjectReader that will read or update instances of specified type, T.

    T

    the type for which to create a com.fasterxml.jackson.databind.ObjectReader

    returns

    the created com.fasterxml.jackson.databind.ObjectReader.

  27. def registerModule(module: Module): ObjectMapper

    Method for registering a module that can extend functionality provided by this mapper; for example, by adding providers for custom serializers and deserializers.

    Method for registering a module that can extend functionality provided by this mapper; for example, by adding providers for custom serializers and deserializers.

    module

    com.fasterxml.jackson.databind.Module to register.

    Note

    this mutates the underlying com.fasterxml.jackson.databind.ObjectMapper of this ScalaObjectMapper.

  28. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  29. def toString(): String
    Definition Classes
    AnyRef → Any
  30. val underlying: JacksonScalaObjectMapperType
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  34. def writePrettyString(any: Any): String

    Method that can be used to serialize any value as a pretty printed String.

    Method that can be used to serialize any value as a pretty printed String. Uses the prettyObjectMapper and calls Any) on the given value.

    any

    the value to serialize.

    returns

    the pretty printed String representing the serialized value.

    See also

    prettyObjectMapper

    Any)

  35. def writeStringMapAsBuf(stringMap: Map[String, String]): Buf

    Convenience method for doing the multi-step process of serializing a Map[String, String] to a Buf.

    Convenience method for doing the multi-step process of serializing a Map[String, String] to a Buf.

    stringMap

    the Map[String, String] to convert.

    returns

    the Buf.ByteArray.Owned representing the serialized value.

  36. def writeValue(any: Any, outputStream: OutputStream): Unit

    Method that can be used to serialize any value as JSON output, using the output stream provided (using an encoding of com.fasterxml.jackson.core.JsonEncoding#UTF8.

    Method that can be used to serialize any value as JSON output, using the output stream provided (using an encoding of com.fasterxml.jackson.core.JsonEncoding#UTF8.

    Note: this method does not close the underlying stream explicitly here; however, the com.fasterxml.jackson.core.JsonFactory this mapper uses may choose to close the stream depending on its settings (by default, it will try to close it when com.fasterxml.jackson.core.JsonGenerator constructed is closed).

    any

    the value to serialize.

    outputStream

    the OutputStream to which to serialize.

  37. def writeValueAsBuf(any: Any): Buf

    Method that can be used to serialize any value as a Buf.

    Method that can be used to serialize any value as a Buf. Functionally equivalent to calling Any) and then wrapping the results in an "owned" Buf.ByteArray.

    any

    the value to serialize.

    returns

    the Buf.ByteArray.Owned representing the serialized value.

    See also

    Any)

    Buf.ByteArray.Owned

  38. def writeValueAsBytes(any: Any): Array[Byte]

    Method that can be used to serialize any value as a Array[Byte].

    Method that can be used to serialize any value as a Array[Byte]. Functionally equivalent to calling JacksonObjectMapper#writeValue(Writer,Object) with a java.io.ByteArrayOutputStream and getting bytes, but more efficient. Encoding used will be UTF-8.

    any

    the value to serialize.

    returns

    the Array[Byte] representing the serialized value.

  39. def writeValueAsString(any: Any): String

    Method that can be used to serialize any value as a String.

    Method that can be used to serialize any value as a String. Functionally equivalent to calling JacksonObjectMapper#writeValue(Writer,Object) with a java.io.StringWriter and constructing String, but more efficient.

    any

    the value to serialize.

    returns

    the String representing the serialized value.

Inherited from AnyRef

Inherited from Any

Ungrouped