Class JacksonCompat

java.lang.Object
org.springframework.vault.support.JacksonCompat

public abstract class JacksonCompat extends Object
Internal compatibility facade for Jackson 2 and Jackson 3.

Detects the available Jackson generation at runtime and prefers Jackson 3 when both are present.

This class is intened for internal use only and will be removed in future versions.

Since:
4.0
Author:
Mark Paluch
  • Constructor Details

    • JacksonCompat

      public JacksonCompat()
  • Method Details

    • instance

      public static JacksonCompat instance()
      Return the active JacksonCompat strategy for the current classpath.
      Returns:
      the active JacksonCompat strategy.
    • isJackson3

      public boolean isJackson3()
      Return whether the active strategy is backed by Jackson 3.
      Returns:
      true if Jackson 3 is active; false otherwise.
    • createHttpMessageConverter

      public abstract AbstractHttpMessageConverter<Object> createHttpMessageConverter()
      Create an HTTP message converter backed by the active Jackson generation.
      Returns:
      a configured HTTP message converter.
    • registerCodecs

      public abstract void registerCodecs(Consumer<Object> messageConverters)
      Register JSON encoder and decoder codecs for the active Jackson generation.
      Parameters:
      messageConverters - a consumer receiving the codecs to register.
    • getJsonNodeClass

      public abstract Class<Object> getJsonNodeClass()
      Return the JSON tree model type used by the active Jackson generation.
      Returns:
      the active JSON node class.
    • getAt

      public abstract Object getAt(Object jsonNode, String path)
      Resolve a JSON pointer path against a JSON tree node.
      Parameters:
      jsonNode - the source JSON tree node.
      path - the JSON pointer expression.
      Returns:
      the value located at the given path.
    • getObjectMapperAccessor

      public abstract JacksonCompat.ObjectMapperAccessor getObjectMapperAccessor()
      Return the default JSON mapper accessor for the active Jackson generation.
      Returns:
      the default JacksonCompat.ObjectMapperAccessor.
    • getPrettyPrintObjectMapperAccessor

      public abstract JacksonCompat.ObjectMapperAccessor getPrettyPrintObjectMapperAccessor()
      Return a JSON mapper accessor configured for pretty-print output.
      Returns:
      the pretty-print JacksonCompat.ObjectMapperAccessor.
    • getObjectMapperAccessor

      public abstract @Nullable JacksonCompat.ObjectMapperAccessor getObjectMapperAccessor(List<HttpMessageConverter<?>> messageConverters)
      Attempt to obtain an JacksonCompat.ObjectMapperAccessor from the given message converters.
      Parameters:
      messageConverters - the converters to inspect.
      Returns:
      the matching JacksonCompat.ObjectMapperAccessor, or null if none can be found.