JsonHttpMessageConverter<T> class

Inheritance

Constructors

JsonHttpMessageConverter()

Properties

defaultCharset ↔ dynamic
read / write, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
supportedMediaTypes List<MediaType>
read / write, inherited

Methods

addDefaultHeaders(HttpHeadersWrapper headers, T t, MediaType contentType) → void
  • Add default headers to the output message.
    • This implementation delegates to #getDefaultContentType(Object) if a content
    • type was not provided, set if necessary the default character set, calls
    • #getContentLength, and sets the corresponding headers.
  • inherited
    canRead(MediaType mediaType) bool
  • Returns true if any of the #setSupportedMediaTypes(List)
    • supported media types MediaType#includes(MediaType) include the
    • given media type.
    • @param mediaType the media type to read, can be null if not specified.
    • Typically the value of a Content-Type header.
    • @return true if the supported media types include the media type,
    • or if the media type is null
  • inherited
    canWrite(MediaType mediaType) bool
  • Returns true if the given media type includes any of the
    • #setSupportedMediaTypes(List) supported media types.
    • @param mediaType the media type to write, can be null if not specified.
    • Typically the value of an Accept header.
    • @return true if the supported media types are compatible with the media type,
    • or if the media type is null
  • inherited
    getContentLength(T t, MediaType contentType) num
  • Returns the content length for the given type.
    • By default, this returns null, meaning that the content length is unknown.
    • Can be overridden in subclasses.
    • @param t the type to return the content length for
    • @return the content length, or null if not known
  • inherited
    getDefaultContentType(T t) MediaType
  • Returns the default content type for the given type. Called when #write
    • is invoked without a specified content type parameter.
    • By default, this returns the first element of the
    • #setSupportedMediaTypes(List) supportedMediaTypes property, if any.
    • Can be overridden in subclasses.
    • @param t the type to return the content type for
    • @return the content type, or null if not known
  • inherited
    getSupportedMediaTypes() List<MediaType>
    override
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a non-existent method or property is accessed. [...]
    inherited
    read(HttpInputMessage inputMessage) → T
  • This implementation simple delegates to #readInternal(HttpInputMessage).
    • Future implementations might add some default behavior, however.
  • inherited
    readInternal(HttpInputMessage inputMessage) → T
  • Abstract template method that reads the actual object. Invoked from {@link #read}.
    • @param clazz the type of object to return
    • @param inputMessage the HTTP input message to read from
    • @return the converted object
  • override
    setSupportedMediaTypes(List<MediaType> supportedMediaTypes) → void
  • Set the list of MediaType objects supported by this converter.
  • inherited
    toString() String
    Returns a string representation of this object.
    inherited
    write(T t, MediaType contentType, HttpOutputMessage outputMessage) → void
  • This implementation sets the default headers by calling #addDefaultHeaders,
    • and then calls #writeInternal.
  • inherited
    writeInternal(T t, HttpOutputMessage outputMessage) → void
  • Abstract template method that writes the actual body. Invoked from #write.
    • @param t the object to write to the output message
    • @param outputMessage the HTTP output message to write to
  • override

    Operators

    operator ==(Object other) bool
    The equality operator. [...]
    inherited