Package com.nimbusds.common.json
Class JSONObjectWriter<T extends net.minidev.json.JSONAware>
- java.lang.Object
-
- com.nimbusds.common.json.JSONObjectWriter<T>
-
- All Implemented Interfaces:
Consumer<T>
public class JSONObjectWriter<T extends net.minidev.json.JSONAware> extends Object implements Consumer<T>
JSON object writer for JAX-RS result streaming.
-
-
Constructor Summary
Constructors Constructor Description JSONObjectWriter(Writer writer, KeyExtractor<T> keyExtractor)
Creates a new JSON object writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(T element)
void
writeEnd()
Writes out the closing '}' of the JSON object and closes the writer.void
writeStart()
Writes out the opening '{' of the JSON object.
-
-
-
Constructor Detail
-
JSONObjectWriter
public JSONObjectWriter(Writer writer, KeyExtractor<T> keyExtractor)
Creates a new JSON object writer.- Parameters:
writer
- Writer for the JSON object. Must not benull
.keyExtractor
- Extracts or determines a JSON object key from the appended elements. Must not benull
.
-
-
Method Detail
-
writeStart
public void writeStart()
Writes out the opening '{' of the JSON object.
-
writeEnd
public void writeEnd()
Writes out the closing '}' of the JSON object and closes the writer.
-
-