MCPcopy
hub / github.com/google/gson / beforeName

Method beforeName

src/main/java/com/google/gson/stream/JsonWriter.java:501–510  ·  view source on GitHub ↗

Inserts any necessary separators and whitespace before a name. Also adjusts the stack to expect the name's value.

()

Source from the content-addressed store, hash-verified

499 * adjusts the stack to expect the name's value.
500 */
501 private void beforeName() throws IOException {
502 JsonScope context = peek();
503 if (context == JsonScope.NONEMPTY_OBJECT) { // first in object
504 out.write(',');
505 } else if (context != JsonScope.EMPTY_OBJECT) { // not in an object!
506 throw new IllegalStateException("Nesting problem: " + stack);
507 }
508 newline();
509 replaceTop(JsonScope.DANGLING_NAME);
510 }
511
512 /**
513 * Inserts any necessary separators and whitespace before a literal value,

Callers 1

nameMethod · 0.95

Calls 4

peekMethod · 0.95
newlineMethod · 0.95
replaceTopMethod · 0.95
writeMethod · 0.45

Tested by

no test coverage detected