HttpMessageConverter that can convert an HTTP request
into a target object of a specified generic type and a source object of a specified
generic type into an HTTP response.
org.springframework.core.ParameterizedTypeReference
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if readable; false otherwisethe (potentially generic) type to test for readability type, Class<?> a context class for the target type, for example a class
in which the target type appears in a method signature (can be contextClass, MediaType null)the media type to read, can be mediaType)null if not specified.
Typically, the value of a Content-Type header.Indicates whether the given type can be read by this converter. |
| public boolean | Returns: true if writable; false otherwisethe (potentially generic) type to test for writability
(can be type, Class<?> null if not specified)the source object class to test for writability clazz, MediaType the media type to write (can be mediaType)null if not specified);
typically the value of an Accept header.Indicates whether the given class can be written by this converter. |
| public T | Returns: the converted objectthe (potentially generic) type of object to return. This type must have
previously been passed to the type, Class<?> canRead method of this interface,
which must have returned true.a context class for the target type, for example a class
in which the target type appears in a method signature (can be contextClass, HttpInputMessage null)the HTTP input message to read from inputMessage)Read an object of the given type form the given input message, and returns it. |
| public void | write(T
the object to write to the output message. The type of this object must
have previously been passed to the t, Type canWrite method of this
interface, which must have returned true.the (potentially generic) type of object to write. This type must have
previously been passed to the type, MediaType canWrite method of this interface,
which must have returned true. Can be null if not specified.the content type to use when writing. May be contentType, HttpOutputMessage null to
indicate that the default content type of the converter must be used. If not
null, this media type must have previously been passed to the
canWrite method of this interface, which must have returned
true.the message to write to outputMessage)Write a given object to the given output message. |
| canRead | back to summary |
|---|---|
| public boolean canRead(Type type, Class<?> contextClass, MediaType mediaType) Indicates whether the given type can be read by this converter.
This method should perform the same checks as
| |
| canWrite | back to summary |
|---|---|
| public boolean canWrite(Type type, Class<?> clazz, MediaType mediaType) Indicates whether the given class can be written by this converter. This method should perform the same checks as
| |
| read | back to summary |
|---|---|
| public T read(Type type, Class<?> contextClass, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException Read an object of the given type form the given input message, and returns it.
| |
| write | back to summary |
|---|---|
| public void write(T t, Type type, MediaType contentType, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException Write a given object to the given output message.
| |