7
7
8
8
import java .io .IOException ;
9
9
10
+ import com .fasterxml .jackson .core .io .SerializedString ;
11
+ import com .fasterxml .jackson .core .util .Separators ;
12
+
10
13
/**
11
14
* Interface for objects that implement pretty printer functionality, such
12
15
* as indentation.
17
20
* Note: since Jackson 2.1, stateful implementations MUST implement
18
21
* {@link com.fasterxml.jackson.core.util.Instantiatable} interface,
19
22
* to allow for constructing per-generation instances and avoid
20
- * state corruption (see [JACKSON-851] for details) .
23
+ * state corruption.
21
24
* Stateless implementations need not do this; but those are less common.
22
25
*/
23
26
public interface PrettyPrinter
24
27
{
28
+ /**
29
+ * @since 2.9
30
+ */
31
+ public final static Separators DEFAULT_SEPARATORS = Separators .createDefaultInstance ();
32
+
33
+ /**
34
+ * Default String used for separating root values is single space.
35
+ *
36
+ * @since 2.9
37
+ */
38
+ public final static SerializedString DEFAULT_ROOT_VALUE_SEPARATOR = new SerializedString (" " );
39
+
25
40
/*
26
41
/**********************************************************
27
42
/* First methods that act both as events, and expect
@@ -42,8 +57,7 @@ public interface PrettyPrinter
42
57
* to output some other suitable and nice-looking separator
43
58
* (tab(s), space(s), linefeed(s) or any combination thereof).
44
59
*/
45
- void writeRootValueSeparator (JsonGenerator jg )
46
- throws IOException , JsonGenerationException ;
60
+ void writeRootValueSeparator (JsonGenerator gen ) throws IOException ;
47
61
48
62
// // Object handling
49
63
@@ -57,8 +71,7 @@ void writeRootValueSeparator(JsonGenerator jg)
57
71
* to output a curly bracket as well, but can surround that
58
72
* with other (white-space) decoration.
59
73
*/
60
- void writeStartObject (JsonGenerator gen )
61
- throws IOException , JsonGenerationException ;
74
+ void writeStartObject (JsonGenerator gen ) throws IOException ;
62
75
63
76
/**
64
77
* Method called after an Object value has been completely output
@@ -73,8 +86,7 @@ void writeStartObject(JsonGenerator gen)
73
86
* @param nrOfEntries Number of direct members of the array that
74
87
* have been output
75
88
*/
76
- void writeEndObject (JsonGenerator gen , int nrOfEntries )
77
- throws IOException , JsonGenerationException ;
89
+ void writeEndObject (JsonGenerator gen , int nrOfEntries ) throws IOException ;
78
90
79
91
/**
80
92
* Method called after an object entry (field:value) has been completely
@@ -85,8 +97,7 @@ void writeEndObject(JsonGenerator gen, int nrOfEntries)
85
97
* to output a comma as well, but can surround that with other
86
98
* (white-space) decoration.
87
99
*/
88
- void writeObjectEntrySeparator (JsonGenerator gen )
89
- throws IOException , JsonGenerationException ;
100
+ void writeObjectEntrySeparator (JsonGenerator gen ) throws IOException ;
90
101
91
102
/**
92
103
* Method called after an object field has been output, but
@@ -97,8 +108,7 @@ void writeObjectEntrySeparator(JsonGenerator gen)
97
108
* to output a colon as well, but can surround that with other
98
109
* (white-space) decoration.
99
110
*/
100
- void writeObjectFieldValueSeparator (JsonGenerator gen )
101
- throws IOException , JsonGenerationException ;
111
+ void writeObjectFieldValueSeparator (JsonGenerator gen ) throws IOException ;
102
112
103
113
// // // Array handling
104
114
@@ -112,8 +122,7 @@ void writeObjectFieldValueSeparator(JsonGenerator gen)
112
122
* to output a bracket as well, but can surround that
113
123
* with other (white-space) decoration.
114
124
*/
115
- void writeStartArray (JsonGenerator gen )
116
- throws IOException , JsonGenerationException ;
125
+ void writeStartArray (JsonGenerator gen ) throws IOException ;
117
126
118
127
/**
119
128
* Method called after an Array value has been completely output
@@ -128,8 +137,7 @@ void writeStartArray(JsonGenerator gen)
128
137
* @param nrOfValues Number of direct members of the array that
129
138
* have been output
130
139
*/
131
- void writeEndArray (JsonGenerator gen , int nrOfValues )
132
- throws IOException , JsonGenerationException ;
140
+ void writeEndArray (JsonGenerator gen , int nrOfValues ) throws IOException ;
133
141
134
142
/**
135
143
* Method called after an array value has been completely
@@ -140,8 +148,7 @@ void writeEndArray(JsonGenerator gen, int nrOfValues)
140
148
* to output a comma as well, but can surround that with other
141
149
* (white-space) decoration.
142
150
*/
143
- void writeArrayValueSeparator (JsonGenerator gen )
144
- throws IOException , JsonGenerationException ;
151
+ void writeArrayValueSeparator (JsonGenerator gen ) throws IOException ;
145
152
146
153
/*
147
154
/**********************************************************
@@ -159,8 +166,7 @@ void writeArrayValueSeparator(JsonGenerator gen)
159
166
* Default handling does not output anything, but pretty-printer
160
167
* is free to add any white space decoration.
161
168
*/
162
- void beforeArrayValues (JsonGenerator gen )
163
- throws IOException , JsonGenerationException ;
169
+ void beforeArrayValues (JsonGenerator gen ) throws IOException ;
164
170
165
171
/**
166
172
* Method called after object start marker has been output,
@@ -171,7 +177,6 @@ void beforeArrayValues(JsonGenerator gen)
171
177
* Default handling does not output anything, but pretty-printer
172
178
* is free to add any white space decoration.
173
179
*/
174
- void beforeObjectEntries (JsonGenerator gen )
175
- throws IOException , JsonGenerationException ;
180
+ void beforeObjectEntries (JsonGenerator gen ) throws IOException ;
176
181
}
177
182
0 commit comments