diff --git a/doc/src/sphinx/user-guide/json/index.rst b/doc/src/sphinx/user-guide/json/index.rst index 0b7e871fd..240175817 100644 --- a/doc/src/sphinx/user-guide/json/index.rst +++ b/doc/src/sphinx/user-guide/json/index.rst @@ -135,7 +135,7 @@ TwitterUtil `ScalaObjectMapper` ------------------------------- The TwitterUtil |ScalaObjectMapper|_ is a thin wrapper around a configured |jackson-module-scala|_ -`com.fasterxml.jackson.module.scala.ScalaObjectMapper `_. +`com.fasterxml.jackson.module.scala.ScalaObjectMapper `_. In Finatra, the recommended way to construct a |ScalaObjectMapper|_ is via the Finatra |ScalaObjectMapperModule|_. c.t.f.jackson.modules.ScalaObjectMapperModule @@ -229,27 +229,27 @@ Adding a Custom Serializer or Deserializer To register a custom serializer or deserializer, configure any custom serializer or deserializer via the methods provided by the |ScalaObjectMapperModule|_. -- Create a new Jackson `com.fasterxml.jackson.databind.Module `_ implementation. +- Create a new Jackson `com.fasterxml.jackson.databind.JacksonModule `_ implementation. .. tip:: - To implement a new Jackson `Module `_ for adding a basic custom serializer or deserializer, you can - use the `com.fasterxml.jackson.databind.module.SimpleModule `_. + To implement a new Jackson `Module `_ for adding a basic custom serializer or deserializer, you can + use the `com.fasterxml.jackson.databind.module.SimpleModule `_. Note, that if you want to register a `JsonSerializer` or `JsonDeserializer` over a parameterized type, such as a `Collection[T]` or `Map[T, U]`, that you should instead implement - `com.fasterxml.jackson.databind.deser.Deserializers `_ - or `com.fasterxml.jackson.databind.ser.Serializers `_ + `com.fasterxml.jackson.databind.deser.Deserializers `_ + or `com.fasterxml.jackson.databind.ser.Serializers `_ which provide callbacks to match the full signatures of the class to deserialize into via a Jackson `JavaType`. Also note that with this usage it is generally recommended to add your `Serializers` or - `Deserializers` implementation via a |jackson-module-scala|_ `JacksonModule `_. - (which is an extension of `com.fasterxml.jackson.databind.Module `_ + `Deserializers` implementation via a |jackson-module-scala|_ `JacksonModule `_. + (which is an extension of `com.fasterxml.jackson.databind.JacksonModule `_ and can thus be used in place). See example below. - Add your serializer or deserializer using the `SimpleModule#addSerializer` or `SimpleModule#addDeserializer` methods in your module. -- In your custom |ScalaObjectMapperModule|_ extension, add the Jackson `Module `_ implementation to list of additional Jackson modules by overriding and implementing the `ScalaObjectMapperModule#additionalJacksonModules`. +- In your custom |ScalaObjectMapperModule|_ extension, add the `JacksonModule `_ implementation to list of additional Jackson modules by overriding and implementing the `ScalaObjectMapperModule#additionalJacksonModules`. For example: first create the serializer or deserializer (a deserializer example is shown below) @@ -355,7 +355,7 @@ features: - Throws a `JsonMappingException` when required fields are missing from the parsed JSON. - Uses specified `case class` default values when fields are missing in the incoming JSON. - Properly deserializes a `Seq[Long]` (see: https://github.com/FasterXML/jackson-module-scala/issues/62). -- Supports `"wrapped values" `__ using `c.t.util.jackson.WrappedValue `_. +- Supports `"wrapped values" `__ using `c.t.util.jackson.WrappedValue `_. - Support for field and method level validations via integration with the `util-validator `__ Bean Validation 2.0 style validations during JSON deserialization. - Accumulates all JSON deserialization errors (instead of failing fast) in a returned sub-class of `JsonMappingException` (see: `CaseClassMappingException `_). @@ -372,11 +372,11 @@ Jackson InjectableValues Support -------------------------------- By default, the Finatra provides a |ScalaObjectMapper|_ via the |ScalaObjectMapperModule|_ configured -to resolve Jackson `InjectableValues `_ +to resolve Jackson `InjectableValues `_ via a given Google `Guice `_ `Injector `_. The default is very similar to the `jackson-module-guice `_ -- -`GuiceInjectableValues `_. +`GuiceInjectableValues `_. .. note:: @@ -407,7 +407,7 @@ the mapper was configured. In this case, the framework would attempt to obtain a from the object graph. As mentioned, this is essentially the same functionality found in the `jackson-module-guice `__ -`GuiceInjectableValues `__ +`GuiceInjectableValues `__ with a key difference being that the Finatra version ensures we do not attempt lookup of a field from the Guice Injector **unless there is a non-null Guice Injector configured and the field is specifically annotated** with one of the supporting annotations. @@ -503,9 +503,9 @@ ensure usage of a consistently configured mapper across your application. Implement via a Custom |ScalaObjectMapperModule|_ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- First, create a new Jackson `com.fasterxml.jackson.databind.Module `__ implementation. You can use the `com.fasterxml.jackson.databind.module.SimpleModule `_. +- First, create a new Jackson `com.fasterxml.jackson.databind.JacksonModule `__ implementation. You can use the `com.fasterxml.jackson.databind.module.SimpleModule `_. - Add your `MixIn` using the `SimpleModule#setMixInAnnotation` method in your module. -- In your custom |ScalaObjectMapperModule|_ extension, add the Jackson `Module `__. +- In your custom |ScalaObjectMapperModule|_ extension, add the `JacksonModule `__. For example, create a new Jackson `SimpleModule`: