Class TypeConstrainedMappingJackson2HttpMessageConverter
java.lang.Object
org.springframework.http.converter.AbstractHttpMessageConverter<T>
org.springframework.http.converter.AbstractGenericHttpMessageConverter<Object>
org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
org.springframework.hateoas.server.mvc.TypeConstrainedMappingJackson2HttpMessageConverter
- All Implemented Interfaces:
GenericHttpMessageConverter<Object>
,HttpMessageConverter<Object>
- Direct Known Subclasses:
HalFormsHttpMessageConverter
public class TypeConstrainedMappingJackson2HttpMessageConverter
extends MappingJackson2HttpMessageConverter
Extension of
MappingJackson2HttpMessageConverter
to constrain the ability to read and write HTTP message
based on the target type. Useful in case the ObjectMapper
about to be configured has customizations that
shall only be applied to object trees of a certain base type.- Author:
- Oliver Gierke
-
Field Summary
Fields inherited from class org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
defaultObjectMapper
Fields inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
logger
-
Constructor Summary
ConstructorDescriptionCreates a newTypeConstrainedMappingJackson2HttpMessageConverter
for the given type.TypeConstrainedMappingJackson2HttpMessageConverter
(Class<?> type, List<MediaType> supportedMediaTypes, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Convenience constructor to supply all parameters at once. -
Method Summary
Methods inherited from class org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
getMediaTypesForProblemDetail, setJsonPrefix, setPrefixJson, writePrefix
Methods inherited from class org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
customizeReader, customizeWriter, getCharset, getContentLength, getDefaultContentType, getJavaType, getJsonEncoding, getObjectMapper, getObjectMappersForType, getSupportedMediaTypes, logWarningIfNecessary, read, readInternal, registerObjectMappersForType, setObjectMapper, setPrettyPrint, setSupportedMediaTypes, supportsRepeatableWrites, writeInternal, writeSuffix
Methods inherited from class org.springframework.http.converter.AbstractGenericHttpMessageConverter
canWrite, supports, write, writeInternal
Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
addDefaultHeaders, canRead, canWrite, getDefaultCharset, getSupportedMediaTypes, read, setDefaultCharset, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.http.converter.HttpMessageConverter
getSupportedMediaTypes, read, write
-
Constructor Details
-
TypeConstrainedMappingJackson2HttpMessageConverter
Creates a newTypeConstrainedMappingJackson2HttpMessageConverter
for the given type.- Parameters:
type
- must not be null.
-
TypeConstrainedMappingJackson2HttpMessageConverter
public TypeConstrainedMappingJackson2HttpMessageConverter(Class<?> type, List<MediaType> supportedMediaTypes, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Convenience constructor to supply all parameters at once.- Parameters:
type
-supportedMediaTypes
-objectMapper
-
-
-
Method Details
-
canRead
- Specified by:
canRead
in interfaceHttpMessageConverter<Object>
- Overrides:
canRead
in classAbstractJackson2HttpMessageConverter
-
canRead
- Specified by:
canRead
in interfaceGenericHttpMessageConverter<Object>
- Overrides:
canRead
in classAbstractJackson2HttpMessageConverter
-
canWrite
- Specified by:
canWrite
in interfaceHttpMessageConverter<Object>
- Overrides:
canWrite
in classAbstractJackson2HttpMessageConverter
-