Interface JsonProvider<T>

Type Parameters:
T - type of input
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface JsonProvider<T>
Provides conversion to JSON of the input
  • Method Summary

    Modifier and Type
    Method
    Description
    com.fasterxml.jackson.databind.JsonNode
    from(T json)
    Convert the input object into JSON
    default com.fasterxml.jackson.databind.JsonNode
    jsonFrom(T item)
    Execute the provider, wrapping exceptions up as assertion failures
  • Method Details

    • from

      com.fasterxml.jackson.databind.JsonNode from(T json) throws IOException
      Convert the input object into JSON
      Parameters:
      json - the json source
      Returns:
      a loaded JsonNode from the source
      Throws:
      IOException - on load error
    • jsonFrom

      default com.fasterxml.jackson.databind.JsonNode jsonFrom(T item)
      Execute the provider, wrapping exceptions up as assertion failures
      Parameters:
      item - the item to unpack - this will be of type T but we allow it to be Object as Hamcrest is poorly behaved with type safety
      Returns:
      the loaded JsonNode or an assertion failure if the load failed, or the input is null