Skip to content

Commit 851a379

Browse files
committed
Fix #517
1 parent 2ea7b19 commit 851a379

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

release-notes/VERSION-2.x

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ JSON library.
1414
=== Releases ===
1515
------------------------------------------------------------------------
1616

17+
2.10.0.pr2
18+
19+
#517: Add `JsonGenerator.writeStartObject(Object, int)` (needed by CBOR, maybe Avro)
20+
#549: Add configurability of "quote character" for JSON factory
21+
1722
2.10.0.pr1 (19-Jul-2019)
1823

1924
#433: Add Builder pattern for creating configured Stream factories
@@ -39,7 +44,6 @@ JSON library.
3944
(reported by Alex R)
4045
#548: ByteQuadsCanonicalizer: ArrayIndexOutOfBoundsException in addName
4146
(reported by Alex R)
42-
#549: Add configurability of "quote character" for JSON factory
4347

4448
2.9.10 (not yet released)
4549

src/main/java/com/fasterxml/jackson/core/JsonGenerator.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ public void setCurrentValue(Object v) {
725725
*/
726726
public abstract void writeStartArray() throws IOException;
727727

728+
// TODO: deprecate in 2.11 (remove from 3.0)
728729
/**
729730
* Method for writing start marker of an Array value, similar
730731
* to {@link #writeStartArray()}, but also specifying how many
@@ -743,7 +744,23 @@ public void setCurrentValue(Object v) {
743744
public void writeStartArray(int size) throws IOException {
744745
writeStartArray();
745746
}
746-
747+
748+
/**
749+
* @since 2.10
750+
*/
751+
public void writeStartArray(Object forValue) throws IOException {
752+
writeStartArray();
753+
setCurrentValue(forValue);
754+
}
755+
756+
/**
757+
* @since 2.10
758+
*/
759+
public void writeStartArray(Object forValue, int size) throws IOException {
760+
writeStartArray(size);
761+
setCurrentValue(forValue);
762+
}
763+
747764
/**
748765
* Method for writing closing marker of a JSON Array value
749766
* (character ']'; plus possible white space decoration

src/main/java/com/fasterxml/jackson/core/util/JsonGeneratorDelegate.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ public JsonGenerator setPrettyPrinter(PrettyPrinter pp) {
196196
@Override
197197
public void writeStartArray(int size) throws IOException { delegate.writeStartArray(size); }
198198

199+
@Override
200+
public void writeStartArray(Object forValue) throws IOException { delegate.writeStartArray(forValue); }
201+
202+
@Override
203+
public void writeStartArray(Object forValue, int size) throws IOException { delegate.writeStartArray(forValue, size); }
204+
199205
@Override
200206
public void writeEndArray() throws IOException { delegate.writeEndArray(); }
201207

0 commit comments

Comments
 (0)