JavaScript is disabled on your browser.
Constructor Summary
Constructors
Constructor and Description
GsonHttpMessageConverter ()
Construct a new GsonHttpMessageConverter
with default configuration.
GsonHttpMessageConverter (com.google.gson.Gson gson)
Construct a new GsonHttpMessageConverter
with the given delegate.
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
com.google.gson.Gson
getGson ()
Return the configured Gson
instance for this converter.
protected java.lang.Object
readInternal (java.lang.reflect.Type resolvedType,
java.io.Reader reader)
Template method that reads the JSON-bound object from the given Reader
.
void
setGson (com.google.gson.Gson gson)
Set the Gson
instance to use.
protected void
writeInternal (java.lang.Object o,
java.lang.reflect.Type type,
java.io.Writer writer)
Template method that writes the JSON-bound object to the given Writer
.
Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
addDefaultHeaders , canRead , canRead , canWrite , canWrite , getContentLength , getDefaultCharset , getDefaultContentType , getSupportedMediaTypes , read , setDefaultCharset , setSupportedMediaTypes , write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Method Detail
readInternal
protected java.lang.Object readInternal(java.lang.reflect.Type resolvedType,
java.io.Reader reader)
throws java.lang.Exception
Template method that reads the JSON-bound object from the given Reader
.
Specified by:
readInternal
in class AbstractJsonHttpMessageConverter
Parameters:
resolvedType
- the resolved generic type
reader
- the Reader to use
Returns:
the JSON-bound object
Throws:
java.lang.Exception
- in case of read/parse failures
writeInternal
protected void writeInternal(java.lang.Object o,
@Nullable
java.lang.reflect.Type type,
java.io.Writer writer)
throws java.lang.Exception
Template method that writes the JSON-bound object to the given Writer
.
Specified by:
writeInternal
in class AbstractJsonHttpMessageConverter
Parameters:
o
- the object to write to the output message
type
- the type of object to write (may be null
)
writer
- the Writer to use
Throws:
java.lang.Exception
- in case of write failures