T - the type of the object to convert to a JSON Objectpublic class JsonOutputConverter<T> extends OutputStreamOutputConverter<T> implements OutputConverter<T>
JsonConverter.| Constructor and Description |
|---|
JsonOutputConverter(java.lang.Class<T> targetClass)
Construct a new instance of a JsonOutputConverter that is able to convert objects of the specified
targetClass into JSON Objects and write them into the OutputStream. |
| Modifier and Type | Method and Description |
|---|---|
void |
write(T t)
Converts an object into a JSON Object that is written to the InputStream.
|
getOutputStream, setOutputStreampublic JsonOutputConverter(java.lang.Class<T> targetClass)
targetClass into JSON Objects and write them into the OutputStream.targetClass - The class defining the objects being converted into JSON.public void write(T t)
targetClass in the constructor equals to JsonObject.class, then this method will cast the provided
object into a JsonObject instance and write it directly to the OutputStream. Otherwise, a JsonConverter
will be used to convert the object into a JSON Object.write in interface OutputConverter<T>t - The object to convert into a JSON Object that will be written to the OutputStream.