Interface Jackson2ObjectWriter

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @Deprecated(since="4.0", forRemoval=true) public interface Jackson2ObjectWriter
Deprecated, for removal: This API element is subject to removal in a future version.
since 4.0 in favor of JacksonObjectWriter.
Defines the contract for Object Mapping writers. Implementations of this interface can serialize a given Object to a byte[] containing JSON.

Writer functions can customize how the actual JSON is being written by e.g. obtaining a customized ObjectWriter applying serialization features, date formats, or views.

Since:
3.0
Author:
Mark Paluch
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create a default Jackson2ObjectWriter delegating to ObjectMapper.writeValueAsBytes(Object).
    byte[]
    write(com.fasterxml.jackson.databind.ObjectMapper mapper, Object source)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Write the object graph with the given root source as byte array.
  • Method Details

    • write

      byte[] write(com.fasterxml.jackson.databind.ObjectMapper mapper, Object source) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Write the object graph with the given root source as byte array.
      Parameters:
      mapper - the object mapper to use.
      source - the root of the object graph to marshal.
      Returns:
      a byte array containing the serialized object graph.
      Throws:
      IOException - if an I/O error or JSON serialization error occurs.
    • create

      static Jackson2ObjectWriter create()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a default Jackson2ObjectWriter delegating to ObjectMapper.writeValueAsBytes(Object).
      Returns:
      the default Jackson2ObjectWriter.