2
2
3
3
import java .io .IOException ;
4
4
5
- import com .fasterxml .jackson .core .JsonGenerationException ;
6
5
import com .fasterxml .jackson .core .JsonGenerator ;
7
6
import com .fasterxml .jackson .core .PrettyPrinter ;
8
7
@@ -32,51 +31,49 @@ public class MinimalPrettyPrinter
32
31
* Default String used for separating root values is single space.
33
32
*/
34
33
public final static String DEFAULT_ROOT_VALUE_SEPARATOR = " " ;
35
-
34
+
36
35
protected String _rootValueSeparator = DEFAULT_ROOT_VALUE_SEPARATOR ;
37
36
38
37
/*
39
38
/**********************************************************
40
39
/* Life-cycle, construction, configuration
41
40
/**********************************************************
42
41
*/
43
-
42
+
44
43
public MinimalPrettyPrinter () {
45
44
this (DEFAULT_ROOT_VALUE_SEPARATOR );
46
45
}
47
46
48
47
public MinimalPrettyPrinter (String rootValueSeparator ) {
49
48
_rootValueSeparator = rootValueSeparator ;
50
49
}
51
-
50
+
52
51
public void setRootValueSeparator (String sep ) {
53
52
_rootValueSeparator = sep ;
54
53
}
55
-
54
+
56
55
/*
57
56
/**********************************************************
58
57
/* PrettyPrinter impl
59
58
/**********************************************************
60
59
*/
61
60
62
61
@ Override
63
- public void writeRootValueSeparator (JsonGenerator jg ) throws IOException , JsonGenerationException
62
+ public void writeRootValueSeparator (JsonGenerator g ) throws IOException
64
63
{
65
64
if (_rootValueSeparator != null ) {
66
- jg .writeRaw (_rootValueSeparator );
65
+ g .writeRaw (_rootValueSeparator );
67
66
}
68
67
}
69
-
68
+
70
69
@ Override
71
- public void writeStartObject (JsonGenerator jg )
72
- throws IOException , JsonGenerationException
70
+ public void writeStartObject (JsonGenerator g ) throws IOException
73
71
{
74
- jg .writeRaw ('{' );
72
+ g .writeRaw ('{' );
75
73
}
76
74
77
75
@ Override
78
- public void beforeObjectEntries (JsonGenerator jg )
79
- throws IOException , JsonGenerationException
76
+ public void beforeObjectEntries (JsonGenerator g ) throws IOException
80
77
{
81
78
// nothing special, since no indentation is added
82
79
}
@@ -89,10 +86,9 @@ public void beforeObjectEntries(JsonGenerator jg)
89
86
* colon to separate the two, without additional spaces.
90
87
*/
91
88
@ Override
92
- public void writeObjectFieldValueSeparator (JsonGenerator jg )
93
- throws IOException , JsonGenerationException
89
+ public void writeObjectFieldValueSeparator (JsonGenerator g ) throws IOException
94
90
{
95
- jg .writeRaw (':' );
91
+ g .writeRaw (':' );
96
92
}
97
93
98
94
/**
@@ -103,29 +99,25 @@ public void writeObjectFieldValueSeparator(JsonGenerator jg)
103
99
* comma to separate the two.
104
100
*/
105
101
@ Override
106
- public void writeObjectEntrySeparator (JsonGenerator jg )
107
- throws IOException , JsonGenerationException
102
+ public void writeObjectEntrySeparator (JsonGenerator g ) throws IOException
108
103
{
109
- jg .writeRaw (',' );
104
+ g .writeRaw (',' );
110
105
}
111
106
112
107
@ Override
113
- public void writeEndObject (JsonGenerator jg , int nrOfEntries )
114
- throws IOException , JsonGenerationException
108
+ public void writeEndObject (JsonGenerator g , int nrOfEntries ) throws IOException
115
109
{
116
- jg .writeRaw ('}' );
110
+ g .writeRaw ('}' );
117
111
}
118
112
119
113
@ Override
120
- public void writeStartArray (JsonGenerator jg )
121
- throws IOException , JsonGenerationException
114
+ public void writeStartArray (JsonGenerator g ) throws IOException
122
115
{
123
- jg .writeRaw ('[' );
116
+ g .writeRaw ('[' );
124
117
}
125
118
126
119
@ Override
127
- public void beforeArrayValues (JsonGenerator jg )
128
- throws IOException , JsonGenerationException
120
+ public void beforeArrayValues (JsonGenerator g ) throws IOException
129
121
{
130
122
// nothing special, since no indentation is added
131
123
}
@@ -138,16 +130,14 @@ public void beforeArrayValues(JsonGenerator jg)
138
130
* comma to separate values.
139
131
*/
140
132
@ Override
141
- public void writeArrayValueSeparator (JsonGenerator jg )
142
- throws IOException , JsonGenerationException
133
+ public void writeArrayValueSeparator (JsonGenerator g ) throws IOException
143
134
{
144
- jg .writeRaw (',' );
135
+ g .writeRaw (',' );
145
136
}
146
137
147
138
@ Override
148
- public void writeEndArray (JsonGenerator jg , int nrOfValues )
149
- throws IOException , JsonGenerationException
139
+ public void writeEndArray (JsonGenerator g , int nrOfValues ) throws IOException
150
140
{
151
- jg .writeRaw (']' );
141
+ g .writeRaw (']' );
152
142
}
153
143
}
0 commit comments