public class

StatefulJsonWriter

extends Object
implements Closeable
java.lang.Object
   ↳ com.atlassian.bitbucket.rest.util.StatefulJsonWriter

Summary

Nested Classes
enum StatefulJsonWriter.WritingContext  
class StatefulJsonWriter.WritingState  
Public Constructors
StatefulJsonWriter(JsonGenerator generator)
Public Methods
StatefulJsonWriter beginArray()
StatefulJsonWriter beginObject()
void close()
StatefulJsonWriter endArray()
StatefulJsonWriter endObject()
StatefulJsonWriter endToDocument()
Closes all JSON elements up until (but not including) the outer-most object.
void flush()
StatefulJsonWriter.WritingState getWritingState()
StatefulJsonWriter name(String name)
StatefulJsonWriter nullValue()
StatefulJsonWriter transform(Function<Object, Object> function)
Creates a new writer which transforms all calls to value(Object) only (at the moment).
StatefulJsonWriter value(double value)
StatefulJsonWriter value(boolean value)
StatefulJsonWriter value(Object value)
StatefulJsonWriter value(long value)
StatefulJsonWriter value(String value)
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.io.Closeable
From interface java.lang.AutoCloseable

Public Constructors

public StatefulJsonWriter (JsonGenerator generator)

Public Methods

public StatefulJsonWriter beginArray ()

Throws
IOException

public StatefulJsonWriter beginObject ()

Throws
IOException

public void close ()

Throws
IOException

public StatefulJsonWriter endArray ()

Throws
IOException

public StatefulJsonWriter endObject ()

Throws
IOException

public StatefulJsonWriter endToDocument ()

Closes all JSON elements up until (but not including) the outer-most object.

When this is used on a JSON stream which has only written an array as a top level value, the array is closed.

When this is used on a JSON stream which has only written a primitive as a top level value, nothing is done.

When this is used on a JSON stream which has not yet written anything, nothing is done.

Returns
  • this
Throws
IOException if the method encountered an IO exception while writing to the underlying stream

public void flush ()

Throws
IOException

public StatefulJsonWriter.WritingState getWritingState ()

Returns
  • what context the writer is in wrt what type of JSON element it is currently writing

public StatefulJsonWriter name (String name)

Throws
IOException

public StatefulJsonWriter nullValue ()

Throws
IOException

public StatefulJsonWriter transform (Function<Object, Object> function)

Creates a new writer which transforms all calls to value(Object) only (at the moment).

public StatefulJsonWriter value (double value)

Throws
IOException

public StatefulJsonWriter value (boolean value)

Throws
IOException

public StatefulJsonWriter value (Object value)

Throws
IOException

public StatefulJsonWriter value (long value)

Throws
IOException

public StatefulJsonWriter value (String value)

Throws
IOException