Skip to content

Commit 9cb631d

Browse files
committed
Minor stylistic changes, remove extraneous throws types
1 parent b00ee12 commit 9cb631d

File tree

2 files changed

+47
-57
lines changed

2 files changed

+47
-57
lines changed

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

+24-24
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class DefaultPrettyPrinter
3535
*/
3636
public interface Indenter
3737
{
38-
void writeIndentation(JsonGenerator jg, int level) throws IOException;
38+
void writeIndentation(JsonGenerator g, int level) throws IOException;
3939

4040
/**
4141
* @return True if indenter is considered inline (does not add linefeeds),
@@ -245,26 +245,26 @@ public DefaultPrettyPrinter createInstance() {
245245
*/
246246

247247
@Override
248-
public void writeRootValueSeparator(JsonGenerator jg) throws IOException
248+
public void writeRootValueSeparator(JsonGenerator g) throws IOException
249249
{
250250
if (_rootSeparator != null) {
251-
jg.writeRaw(_rootSeparator);
251+
g.writeRaw(_rootSeparator);
252252
}
253253
}
254254

255255
@Override
256-
public void writeStartObject(JsonGenerator jg) throws IOException
256+
public void writeStartObject(JsonGenerator g) throws IOException
257257
{
258-
jg.writeRaw('{');
258+
g.writeRaw('{');
259259
if (!_objectIndenter.isInline()) {
260260
++_nesting;
261261
}
262262
}
263263

264264
@Override
265-
public void beforeObjectEntries(JsonGenerator jg) throws IOException
265+
public void beforeObjectEntries(JsonGenerator g) throws IOException
266266
{
267-
_objectIndenter.writeIndentation(jg, _nesting);
267+
_objectIndenter.writeIndentation(g, _nesting);
268268
}
269269

270270
/**
@@ -277,12 +277,12 @@ public void beforeObjectEntries(JsonGenerator jg) throws IOException
277277
* (white-space) decoration.
278278
*/
279279
@Override
280-
public void writeObjectFieldValueSeparator(JsonGenerator jg) throws IOException
280+
public void writeObjectFieldValueSeparator(JsonGenerator g) throws IOException
281281
{
282282
if (_spacesInObjectEntries) {
283-
jg.writeRaw(" : ");
283+
g.writeRaw(" : ");
284284
} else {
285-
jg.writeRaw(':');
285+
g.writeRaw(':');
286286
}
287287
}
288288

@@ -296,38 +296,38 @@ public void writeObjectFieldValueSeparator(JsonGenerator jg) throws IOException
296296
* (white-space) decoration.
297297
*/
298298
@Override
299-
public void writeObjectEntrySeparator(JsonGenerator jg) throws IOException
299+
public void writeObjectEntrySeparator(JsonGenerator g) throws IOException
300300
{
301-
jg.writeRaw(',');
302-
_objectIndenter.writeIndentation(jg, _nesting);
301+
g.writeRaw(',');
302+
_objectIndenter.writeIndentation(g, _nesting);
303303
}
304304

305305
@Override
306-
public void writeEndObject(JsonGenerator jg, int nrOfEntries) throws IOException
306+
public void writeEndObject(JsonGenerator g, int nrOfEntries) throws IOException
307307
{
308308
if (!_objectIndenter.isInline()) {
309309
--_nesting;
310310
}
311311
if (nrOfEntries > 0) {
312-
_objectIndenter.writeIndentation(jg, _nesting);
312+
_objectIndenter.writeIndentation(g, _nesting);
313313
} else {
314-
jg.writeRaw(' ');
314+
g.writeRaw(' ');
315315
}
316-
jg.writeRaw('}');
316+
g.writeRaw('}');
317317
}
318318

319319
@Override
320-
public void writeStartArray(JsonGenerator jg) throws IOException
320+
public void writeStartArray(JsonGenerator g) throws IOException
321321
{
322322
if (!_arrayIndenter.isInline()) {
323323
++_nesting;
324324
}
325-
jg.writeRaw('[');
325+
g.writeRaw('[');
326326
}
327327

328328
@Override
329-
public void beforeArrayValues(JsonGenerator jg) throws IOException {
330-
_arrayIndenter.writeIndentation(jg, _nesting);
329+
public void beforeArrayValues(JsonGenerator g) throws IOException {
330+
_arrayIndenter.writeIndentation(g, _nesting);
331331
}
332332

333333
/**
@@ -375,7 +375,7 @@ public static class NopIndenter
375375
public static final NopIndenter instance = new NopIndenter();
376376

377377
@Override
378-
public void writeIndentation(JsonGenerator jg, int level) throws IOException { }
378+
public void writeIndentation(JsonGenerator g, int level) throws IOException { }
379379

380380
@Override
381381
public boolean isInline() { return true; }
@@ -392,9 +392,9 @@ public static class FixedSpaceIndenter extends NopIndenter
392392
public static final FixedSpaceIndenter instance = new FixedSpaceIndenter();
393393

394394
@Override
395-
public void writeIndentation(JsonGenerator jg, int level) throws IOException
395+
public void writeIndentation(JsonGenerator g, int level) throws IOException
396396
{
397-
jg.writeRaw(' ');
397+
g.writeRaw(' ');
398398
}
399399

400400
@Override

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

+23-33
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.io.IOException;
44

5-
import com.fasterxml.jackson.core.JsonGenerationException;
65
import com.fasterxml.jackson.core.JsonGenerator;
76
import com.fasterxml.jackson.core.PrettyPrinter;
87

@@ -32,51 +31,49 @@ public class MinimalPrettyPrinter
3231
* Default String used for separating root values is single space.
3332
*/
3433
public final static String DEFAULT_ROOT_VALUE_SEPARATOR = " ";
35-
34+
3635
protected String _rootValueSeparator = DEFAULT_ROOT_VALUE_SEPARATOR;
3736

3837
/*
3938
/**********************************************************
4039
/* Life-cycle, construction, configuration
4140
/**********************************************************
4241
*/
43-
42+
4443
public MinimalPrettyPrinter() {
4544
this(DEFAULT_ROOT_VALUE_SEPARATOR);
4645
}
4746

4847
public MinimalPrettyPrinter(String rootValueSeparator) {
4948
_rootValueSeparator = rootValueSeparator;
5049
}
51-
50+
5251
public void setRootValueSeparator(String sep) {
5352
_rootValueSeparator = sep;
5453
}
55-
54+
5655
/*
5756
/**********************************************************
5857
/* PrettyPrinter impl
5958
/**********************************************************
6059
*/
6160

6261
@Override
63-
public void writeRootValueSeparator(JsonGenerator jg) throws IOException, JsonGenerationException
62+
public void writeRootValueSeparator(JsonGenerator g) throws IOException
6463
{
6564
if (_rootValueSeparator != null) {
66-
jg.writeRaw(_rootValueSeparator);
65+
g.writeRaw(_rootValueSeparator);
6766
}
6867
}
69-
68+
7069
@Override
71-
public void writeStartObject(JsonGenerator jg)
72-
throws IOException, JsonGenerationException
70+
public void writeStartObject(JsonGenerator g) throws IOException
7371
{
74-
jg.writeRaw('{');
72+
g.writeRaw('{');
7573
}
7674

7775
@Override
78-
public void beforeObjectEntries(JsonGenerator jg)
79-
throws IOException, JsonGenerationException
76+
public void beforeObjectEntries(JsonGenerator g) throws IOException
8077
{
8178
// nothing special, since no indentation is added
8279
}
@@ -89,10 +86,9 @@ public void beforeObjectEntries(JsonGenerator jg)
8986
* colon to separate the two, without additional spaces.
9087
*/
9188
@Override
92-
public void writeObjectFieldValueSeparator(JsonGenerator jg)
93-
throws IOException, JsonGenerationException
89+
public void writeObjectFieldValueSeparator(JsonGenerator g) throws IOException
9490
{
95-
jg.writeRaw(':');
91+
g.writeRaw(':');
9692
}
9793

9894
/**
@@ -103,29 +99,25 @@ public void writeObjectFieldValueSeparator(JsonGenerator jg)
10399
* comma to separate the two.
104100
*/
105101
@Override
106-
public void writeObjectEntrySeparator(JsonGenerator jg)
107-
throws IOException, JsonGenerationException
102+
public void writeObjectEntrySeparator(JsonGenerator g) throws IOException
108103
{
109-
jg.writeRaw(',');
104+
g.writeRaw(',');
110105
}
111106

112107
@Override
113-
public void writeEndObject(JsonGenerator jg, int nrOfEntries)
114-
throws IOException, JsonGenerationException
108+
public void writeEndObject(JsonGenerator g, int nrOfEntries) throws IOException
115109
{
116-
jg.writeRaw('}');
110+
g.writeRaw('}');
117111
}
118112

119113
@Override
120-
public void writeStartArray(JsonGenerator jg)
121-
throws IOException, JsonGenerationException
114+
public void writeStartArray(JsonGenerator g) throws IOException
122115
{
123-
jg.writeRaw('[');
116+
g.writeRaw('[');
124117
}
125118

126119
@Override
127-
public void beforeArrayValues(JsonGenerator jg)
128-
throws IOException, JsonGenerationException
120+
public void beforeArrayValues(JsonGenerator g) throws IOException
129121
{
130122
// nothing special, since no indentation is added
131123
}
@@ -138,16 +130,14 @@ public void beforeArrayValues(JsonGenerator jg)
138130
* comma to separate values.
139131
*/
140132
@Override
141-
public void writeArrayValueSeparator(JsonGenerator jg)
142-
throws IOException, JsonGenerationException
133+
public void writeArrayValueSeparator(JsonGenerator g) throws IOException
143134
{
144-
jg.writeRaw(',');
135+
g.writeRaw(',');
145136
}
146137

147138
@Override
148-
public void writeEndArray(JsonGenerator jg, int nrOfValues)
149-
throws IOException, JsonGenerationException
139+
public void writeEndArray(JsonGenerator g, int nrOfValues) throws IOException
150140
{
151-
jg.writeRaw(']');
141+
g.writeRaw(']');
152142
}
153143
}

0 commit comments

Comments
 (0)