Skip to content

Commit 303b7ed

Browse files
committed
Further removal of state handling from non-json base generator
1 parent ce1b47d commit 303b7ed

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,15 @@ public int getOutputBuffered() {
119119
* The reason it is included here is that it can be stored and accessed hierarchically,
120120
* and gets passed through data-binding.
121121
*/
122-
public Object getCurrentValue() {
123-
TokenStreamContext ctxt = getOutputContext();
124-
return (ctxt == null) ? null : ctxt.getCurrentValue();
125-
}
122+
public abstract Object getCurrentValue();
126123

127124
/**
128125
* Helper method, usually equivalent to:
129126
*<code>
130127
* getOutputContext().setCurrentValue(v);
131128
*</code>
132129
*/
133-
public void setCurrentValue(Object v) {
134-
TokenStreamContext ctxt = getOutputContext();
135-
if (ctxt != null) {
136-
ctxt.setCurrentValue(v);
137-
}
138-
}
130+
public abstract void setCurrentValue(Object v);
139131

140132
/*
141133
/**********************************************************

src/main/java/com/fasterxml/jackson/core/json/JsonGeneratorImpl.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ public abstract class JsonGeneratorImpl extends GeneratorBase
107107
*/
108108

109109
/**
110-
* Object that keeps track of the current contextual state
111-
* of the generator.
110+
* Object that keeps track of the current contextual state of the generator.
112111
*/
113112
protected JsonWriteContext _outputContext;
114113

@@ -138,7 +137,7 @@ public JsonGeneratorImpl(ObjectWriteContext writeCtxt, IOContext ctxt,
138137

139138
_cfgPrettyPrinter = pp;
140139

141-
DupDetector dups = StreamWriteFeature.STRICT_DUPLICATE_DETECTION.enabledIn(streamWriteFeatures)
140+
final DupDetector dups = StreamWriteFeature.STRICT_DUPLICATE_DETECTION.enabledIn(streamWriteFeatures)
142141
? DupDetector.rootDetector(this) : null;
143142
_outputContext = JsonWriteContext.createRootContext(dups);
144143

@@ -200,11 +199,9 @@ public final Object getCurrentValue() {
200199

201200
@Override
202201
public final void setCurrentValue(Object v) {
203-
if (_outputContext != null) {
204-
_outputContext.setCurrentValue(v);
205-
}
202+
_outputContext.setCurrentValue(v);
206203
}
207-
204+
208205
/*
209206
/**********************************************************************
210207
/* Partial API

0 commit comments

Comments
 (0)