Class ProjectingJackson2HttpMessageConverter

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.data.web.ProjectingJackson2HttpMessageConverter
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.http.converter.GenericHttpMessageConverter<Object>, org.springframework.http.converter.HttpMessageConverter<Object>

public class ProjectingJackson2HttpMessageConverter extends org.springframework.http.converter.json.MappingJackson2HttpMessageConverter implements org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware
HttpMessageConverter implementation to enable projected JSON binding to interfaces annotated with ProjectedPayload.
Since:
1.13
Author:
Oliver Gierke, Christoph Strobl
  • 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

    Constructors
    Constructor
    Description
    Creates a new ProjectingJackson2HttpMessageConverter using a default ObjectMapper.
    ProjectingJackson2HttpMessageConverter(com.fasterxml.jackson.databind.ObjectMapper mapper)
    Creates a new ProjectingJackson2HttpMessageConverter for the given ObjectMapper.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canRead(Type type, Class<?> contextClass, org.springframework.http.MediaType mediaType)
     
    boolean
    canWrite(Class<?> clazz, org.springframework.http.MediaType mediaType)
     
    read(Type type, Class<?> contextClass, org.springframework.http.HttpInputMessage inputMessage)
     
    void
     
    void
    setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
     

    Methods inherited from class org.springframework.http.converter.json.MappingJackson2HttpMessageConverter

    getMediaTypesForProblemDetail, setJsonPrefix, setPrefixJson, writePrefix

    Methods inherited from class org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter

    canRead, customizeReader, customizeWriter, getCharset, getContentLength, getDefaultContentType, getJavaType, getJsonEncoding, getObjectMapper, getObjectMappersForType, getSupportedMediaTypes, logWarningIfNecessary, readInternal, registerObjectMappersForType, setObjectMapper, setPrettyPrint, setSupportedMediaTypes, 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

    • ProjectingJackson2HttpMessageConverter

      public ProjectingJackson2HttpMessageConverter()
      Creates a new ProjectingJackson2HttpMessageConverter using a default ObjectMapper.
    • ProjectingJackson2HttpMessageConverter

      public ProjectingJackson2HttpMessageConverter(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Creates a new ProjectingJackson2HttpMessageConverter for the given ObjectMapper.
      Parameters:
      mapper - must not be null.
  • Method Details

    • setBeanClassLoader

      public void setBeanClassLoader(ClassLoader classLoader)
      Specified by:
      setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAware
    • setBeanFactory

      public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      Throws:
      org.springframework.beans.BeansException
    • canRead

      public boolean canRead(Type type, @Nullable Class<?> contextClass, @Nullable org.springframework.http.MediaType mediaType)
      Specified by:
      canRead in interface org.springframework.http.converter.GenericHttpMessageConverter<Object>
      Overrides:
      canRead in class org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
    • canWrite

      public boolean canWrite(Class<?> clazz, @Nullable org.springframework.http.MediaType mediaType)
      Specified by:
      canWrite in interface org.springframework.http.converter.HttpMessageConverter<Object>
      Overrides:
      canWrite in class org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
    • read

      public Object read(Type type, @Nullable Class<?> contextClass, org.springframework.http.HttpInputMessage inputMessage) throws IOException, org.springframework.http.converter.HttpMessageNotReadableException
      Specified by:
      read in interface org.springframework.http.converter.GenericHttpMessageConverter<Object>
      Overrides:
      read in class org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
      Throws:
      IOException
      org.springframework.http.converter.HttpMessageNotReadableException