Interface JacksonCompat.ObjectMapperAccessor

Enclosing class:
JacksonCompat

public static interface JacksonCompat.ObjectMapperAccessor
Accessor for ObjectMapper that provides methods to serialize and deserialize JSON.
  • Method Details

    • create

      Create an accessor using the default mapper configuration of the active strategy.
      Returns:
      a default JacksonCompat.ObjectMapperAccessor.
    • from

      static JacksonCompat.ObjectMapperAccessor from(VaultOperations vaultOperations)
      Create an accessor from the given VaultOperations context.

      If a RestTemplate with a compatible Jackson converter is available, that converter's mapper is used. Otherwise, this method falls back to create().

      Parameters:
      vaultOperations - the operations used to access the current Vault session.
      Returns:
      an JacksonCompat.ObjectMapperAccessor for the current session context.
    • deserialize

      <I> I deserialize(Object json, Class<I> type)
      Deserialize JSON content to the requested target type.
      Parameters:
      json - must not be null.
      type - must not be null.
      Returns:
      the deserialized object.
    • writeValueAsString

      String writeValueAsString(Object object)
      Serialize the given object to its JSON string representation.
      Parameters:
      object - the object to serialize.
      Returns:
      the JSON string representation.