io.vertx.core.json.jackson

## Class JacksonCodec

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

- All Implemented Interfaces:
    JsonCodec

      public class JacksonCodec
      extends Object
      implements JsonCodec

  Author:
    Julien Viet

- - ### Field Summary

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

      `INSTANCE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JacksonCodec()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> T` | `decodeValue(Buffer buf, TypeReference<T> type)` Decode a given JSON buffer to a POJO of the given class type.
    `static <T> T` | `decodeValue(String str, TypeReference<T> type)` Decode a given JSON string to a POJO of the given type.
    `<T> T` | `fromBuffer(Buffer buf, Class<T> clazz)` Like `JsonCodec.fromString(String, Class)` but with a json `Buffer`
    `static <T> T` | `fromBuffer(Buffer buf, TypeReference<T> type)`
    `<T> T` | `fromString(String str, Class<T> clazz)` Decode the provide `json` string to an object extending `clazz`.
    `static <T> T` | `fromString(String str, TypeReference<T> type)`
    `<T> T` | `fromValue(Object json, Class<T> clazz)` Like `JsonCodec.fromString(String, Class)` but with a json `Object`
    `static <T> T` | `fromValue(Object json, TypeReference<T> type)`
    `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 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

    - #### JacksonCodec

          public JacksonCodec()

  - ### Method Detail

    - #### 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`

    - #### fromValue

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

    - #### 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`
      Parameters:
        `str` - the json string
        `clazz` - the required object's class
      Returns:
        the instance
      Throws:
        `DecodeException` - anything preventing the decoding

    - #### fromString

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

      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`
      Throws:
        `DecodeException`

    - #### fromBuffer

          public static <T> T fromBuffer(Buffer buf,
                                         TypeReference<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`
      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`
      Throws:
        `EncodeException`

    - #### decodeValue

          public static <T> T decodeValue(String str,
                                          TypeReference<T> type)
                                   throws DecodeException

      Decode a given JSON string to a POJO of the given type.
      Type Parameters:
        `T` - the generic type.
      Parameters:
        `str` - the JSON string.
        `type` - the type to map to.
      Returns:
        an instance of T
      Throws:
        `DecodeException` - when there is a parsing or invalid mapping.

    - #### decodeValue

          public static <T> T decodeValue(Buffer buf,
                                          TypeReference<T> type)
                                   throws DecodeException

      Decode a given JSON buffer to a POJO of the given class type.
      Type Parameters:
        `T` - the generic type.
      Parameters:
        `buf` - the JSON buffer.
        `type` - the type to map to.
      Returns:
        an instance of T
      Throws:
        `DecodeException` - when there is a parsing or invalid mapping.

Copyright © 2019 Eclipse. All rights reserved.