ScalaReflectionExtensions

com.github.pjfanning.jackson.reflection.ScalaReflectionExtensions
See theScalaReflectionExtensions companion object

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type
ObjectMapper

Members list

Value members

Concrete methods

def constructType[T : JavaTypeable]: JavaType
def convertValue[T : JavaTypeable](fromValue: Any): T

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

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

Attributes

Throws
IllegalArgumentException

If conversion fails due to incompatible type; if so, root cause will contain underlying checked exception data binding functionality threw

def readValue[T : JavaTypeable](jp: JsonParser): T

Method to deserialize JSON content into a Java type, reference to which is passed as argument. Type is passed using so-called "super type token" and specifically needs to be used if the root type is a parameterized (generic) container type.

Method to deserialize JSON content into a Java type, reference to which is passed as argument. Type is passed using so-called "super type token" and specifically needs to be used if the root type is a parameterized (generic) container type.

Attributes

def readValue[T : JavaTypeable](src: File): T
def readValue[T : JavaTypeable](src: URL): T
def readValue[T : JavaTypeable](content: String): T
def readValue[T : JavaTypeable](src: Reader): T
def readValue[T : JavaTypeable](src: InputStream): T
def readValue[T : JavaTypeable](src: Array[Byte]): T
def readValue[T : JavaTypeable](src: Array[Byte], offset: Int, len: Int): T
def readValue[T : JavaTypeable](src: File, rType: RType): T
def readValue[T : JavaTypeable](src: URL, rType: RType): T
def readValue[T : JavaTypeable](content: String, rType: RType): T
def readValue[T : JavaTypeable](src: Reader, rType: RType): T
def readValue[T : JavaTypeable](src: InputStream, rType: RType): T
def readValue[T : JavaTypeable](src: Array[Byte], rType: RType): T
def readValue[T : JavaTypeable](src: Array[Byte], offset: Int, len: Int, rType: RType): T
def readValues[T : JavaTypeable](jp: JsonParser): MappingIterator[T]

Method for reading sequence of Objects from parser stream. Sequence can be either root-level "unwrapped" sequence (without surrounding JSON array), or a sequence contained in a JSON Array. In either case com.fasterxml.jackson.core.JsonParser must point to the first token of the first element, OR not point to any token (in which case it is advanced to the next token). This means, specifically, that for wrapped sequences, parser MUST NOT point to the surrounding START_ARRAY but rather to the token following it.

Method for reading sequence of Objects from parser stream. Sequence can be either root-level "unwrapped" sequence (without surrounding JSON array), or a sequence contained in a JSON Array. In either case com.fasterxml.jackson.core.JsonParser must point to the first token of the first element, OR not point to any token (in which case it is advanced to the next token). This means, specifically, that for wrapped sequences, parser MUST NOT point to the surrounding START_ARRAY but rather to the token following it.

Note that com.fasterxml.jackson.databind.ObjectReader has more complete set of variants.

Attributes

def readerFor[T : JavaTypeable]: ObjectReader

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

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

Attributes

def readerWithView[T : ClassTag]: ObjectReader

Factory method for constructing com.fasterxml.jackson.databind.ObjectReader that will deserialize objects using specified JSON View (filter).

Factory method for constructing com.fasterxml.jackson.databind.ObjectReader that will deserialize objects using specified JSON View (filter).

Attributes

def treeToValue[T : JavaTypeable](n: TreeNode): T
def updateValue[T : JavaTypeable](valueToUpdate: T, src: File): T
def updateValue[T : JavaTypeable](valueToUpdate: T, src: URL): T
def updateValue[T : JavaTypeable](valueToUpdate: T, content: String): T
def updateValue[T : JavaTypeable](valueToUpdate: T, src: Reader): T
def updateValue[T : JavaTypeable](valueToUpdate: T, src: InputStream): T
def updateValue[T : JavaTypeable](valueToUpdate: T, src: Array[Byte]): T
def updateValue[T : JavaTypeable](valueToUpdate: T, src: Array[Byte], offset: Int, len: Int): T
def writerFor[T : JavaTypeable]: ObjectWriter

Factory method for constructing [[com.fasterxml.jackson.databind.ObjectWriter]] that will serialize objects using specified root type, instead of actual runtime type of value. Type must be a super-type of runtime type.

Factory method for constructing [[com.fasterxml.jackson.databind.ObjectWriter]] that will serialize objects using specified root type, instead of actual runtime type of value. Type must be a super-type of runtime type.

Main reason for using this method is performance, as writer is able to pre-fetch serializer to use before write, and if writer is used more than once this avoids addition per-value serializer lookups.

Attributes

def writerWithView[T : ClassTag]: ObjectWriter

Factory method for constructing com.fasterxml.jackson.databind.ObjectWriter that will serialize objects using specified JSON View (filter).

Factory method for constructing com.fasterxml.jackson.databind.ObjectWriter that will serialize objects using specified JSON View (filter).

Attributes