Class HttpMessageContentConverter

java.lang.Object
org.springframework.test.http.HttpMessageContentConverter
All Implemented Interfaces:
JsonConverterDelegate

@Deprecated(since="7.0", forRemoval=true) public class HttpMessageContentConverter extends Object implements JsonConverterDelegate
Deprecated, for removal: This API element is subject to removal in a future version.
in favor of static factory methods in JsonConverterDelegate
Convert HTTP message content for testing purposes.
Since:
6.2
Author:
Stephane Nicoll
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    convert(HttpInputMessage message, MediaType mediaType, ResolvableType targetType)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Convert the given HttpInputMessage whose content must match the given MediaType to the requested targetType.
    <T> T
    convertViaJson(Object value, ResolvableType targetType)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Convert the given raw value to the given targetType by writing it first to JSON and reading it back.
    <T> T
    map(Object value, ResolvableType targetType)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Map the given Object value to the given targetType, via serialization and deserialization to and from JSON.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create an instance with an iterable of the candidates to use.
    of(HttpMessageConverter<?>... candidates)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create an instance with a vararg of the candidates to use.
    <T> T
    read(String content, ResolvableType targetType)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Convert JSON content to the given targetType.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • of

      public static HttpMessageContentConverter of(Iterable<HttpMessageConverter<?>> candidates)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create an instance with an iterable of the candidates to use.
      Parameters:
      candidates - the candidates
    • of

      public static HttpMessageContentConverter of(HttpMessageConverter<?>... candidates)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create an instance with a vararg of the candidates to use.
      Parameters:
      candidates - the candidates
    • read

      public <T> T read(String content, ResolvableType targetType) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: JsonConverterDelegate
      Convert JSON content to the given targetType.
      Specified by:
      read in interface JsonConverterDelegate
      Type Parameters:
      T - the target type
      Parameters:
      content - the JSON content
      targetType - the target type
      Returns:
      the decoded object
      Throws:
      IOException
    • map

      public <T> T map(Object value, ResolvableType targetType) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: JsonConverterDelegate
      Map the given Object value to the given targetType, via serialization and deserialization to and from JSON. This is useful for mapping generic maps and lists to higher level Objects.
      Specified by:
      map in interface JsonConverterDelegate
      Type Parameters:
      T - the target type
      Parameters:
      value - the value to map
      targetType - the target tyep
      Returns:
      the decoded object
      Throws:
      IOException
    • convert

      public <T> T convert(HttpInputMessage message, MediaType mediaType, ResolvableType targetType) throws IOException, HttpMessageNotReadableException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Convert the given HttpInputMessage whose content must match the given MediaType to the requested targetType.
      Type Parameters:
      T - the converted object type
      Parameters:
      message - an input message
      mediaType - the media type of the input
      targetType - the target type
      Returns:
      a value of the given targetType
      Throws:
      IOException
      HttpMessageNotReadableException
    • convertViaJson

      public <T> T convertViaJson(Object value, ResolvableType targetType) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Convert the given raw value to the given targetType by writing it first to JSON and reading it back.
      Type Parameters:
      T - the converted object type
      Parameters:
      value - the value to convert
      targetType - the target type
      Returns:
      a value of the given targetType
      Throws:
      IOException