Inserts any necessary separators and whitespace before a name. Also adjusts the stack to expect the name's value.
()
| 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, |
no test coverage detected