io.vertx.core.json.jackson

## Class DatabindCodec

- java.lang.Object
- - io.vertx.core.json.jackson.JacksonCodec
  - - io.vertx.core.json.jackson.DatabindCodec

- All Implemented Interfaces:
    JsonCodec

      public class DatabindCodec
      extends JacksonCodec

  Author:
    Julien Viet

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DatabindCodec()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JsonParser` | `createParser(Buffer buf)`
    `static JsonParser` | `createParser(String str)`
    `<T> T` | `fromBuffer(Buffer buf, Class<T> clazz)` Like `JsonCodec.fromString(String, Class)` but with a json `Buffer`
    `<T> T` | `fromBuffer(Buffer buf, TypeReference<T> typeRef)`
    `static <T> T` | `fromParser(JsonParser parser, Class<T> type)`
    `<T> T` | `fromString(String str, Class<T> clazz)` Decode the provide `json` string to an object extending `clazz`.
    `<T> T` | `fromString(String str, TypeReference<T> typeRef)`
    `<T> T` | `fromValue(Object json, Class<T> clazz)` Like `JsonCodec.fromString(String, Class)` but with a json `Object`
    `<T> T` | `fromValue(Object json, TypeReference<T> type)`
    `static ObjectMapper` | `mapper()`
    `static ObjectMapper` | `prettyMapper()`
    `Buffer` | `toBuffer(Object object, boolean pretty)` Like `JsonCodec.toString(Object, boolean)` but with a json `Buffer`
    `String` | `toString(Object object, boolean pretty)` Encode the specified `object` to a string.

    - ### Methods inherited from class io.vertx.core.json.jackson.JacksonCodec

      `decodeValue, decodeValue, fromBuffer, fromString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface io.vertx.core.spi.json.JsonCodec

      `toBuffer, toString`

- - ### Constructor Detail

    - #### DatabindCodec

          public DatabindCodec()

  - ### Method Detail

    - #### mapper

          public static ObjectMapper mapper()

      Returns:
        the `ObjectMapper` used for data binding.

    - #### prettyMapper

          public static ObjectMapper prettyMapper()

      Returns:
        the `ObjectMapper` used for data binding configured for indenting output.

    - #### fromValue

          public <T> T fromValue(Object json,
                                 Class<T> clazz)

      Description copied from interface: `JsonCodec`
      Like `JsonCodec.fromString(String, Class)` but with a json `Object`
      Specified by:
        `fromValue` in interface `JsonCodec`
      Overrides:
        `fromValue` in class `JacksonCodec`

    - #### fromValue

          public <T> T fromValue(Object json,
                                 TypeReference<T> type)

      Overrides:
        `fromValue` in class `JacksonCodec`

    - #### fromString

          public <T> T fromString(String str,
                                  Class<T> clazz)
                           throws DecodeException

      Description copied from interface: `JsonCodec`
      Decode the provide `json` string to an object extending `clazz`.
      Specified by:
        `fromString` in interface `JsonCodec`
      Overrides:
        `fromString` in class `JacksonCodec`
      Parameters:
        `str` - the json string
        `clazz` - the required object's class
      Returns:
        the instance
      Throws:
        `DecodeException` - anything preventing the decoding

    - #### fromString

          public <T> T fromString(String str,
                                  TypeReference<T> typeRef)
                           throws DecodeException

      Overrides:
        `fromString` in class `JacksonCodec`
      Throws:
        `DecodeException`

    - #### fromBuffer

          public <T> T fromBuffer(Buffer buf,
                                  Class<T> clazz)
                           throws DecodeException

      Description copied from interface: `JsonCodec`
      Like `JsonCodec.fromString(String, Class)` but with a json `Buffer`
      Specified by:
        `fromBuffer` in interface `JsonCodec`
      Overrides:
        `fromBuffer` in class `JacksonCodec`
      Throws:
        `DecodeException`

    - #### fromBuffer

          public <T> T fromBuffer(Buffer buf,
                                  TypeReference<T> typeRef)
                           throws DecodeException

      Overrides:
        `fromBuffer` in class `JacksonCodec`
      Throws:
        `DecodeException`

    - #### createParser

          public static JsonParser createParser(Buffer buf)

    - #### createParser

          public static JsonParser createParser(String str)

    - #### fromParser

          public static <T> T fromParser(JsonParser parser,
                                         Class<T> type)
                                  throws DecodeException

      Throws:
        `DecodeException`

    - #### toString

          public String toString(Object object,
                                 boolean pretty)
                          throws EncodeException

      Description copied from interface: `JsonCodec`
      Encode the specified `object` to a string.
      Specified by:
        `toString` in interface `JsonCodec`
      Overrides:
        `toString` in class `JacksonCodec`
      Parameters:
        `object` - the object to encode
        `pretty` - `true` to format the string prettily
      Returns:
        the json encoded string
      Throws:
        `EncodeException`

    - #### toBuffer

          public Buffer toBuffer(Object object,
                                 boolean pretty)
                          throws EncodeException

      Description copied from interface: `JsonCodec`
      Like `JsonCodec.toString(Object, boolean)` but with a json `Buffer`
      Specified by:
        `toBuffer` in interface `JsonCodec`
      Overrides:
        `toBuffer` in class `JacksonCodec`
      Throws:
        `EncodeException`

Copyright © 2024 Eclipse. All rights reserved.