File tree Expand file tree Collapse file tree 2 files changed +10
-25
lines changed
main/java/org/metafacture/yaml
test/java/org/metafacture/yaml Expand file tree Collapse file tree 2 files changed +10
-25
lines changed Original file line number Diff line number Diff line change 30
30
import com .fasterxml .jackson .core .SerializableString ;
31
31
import com .fasterxml .jackson .core .io .CharacterEscapes ;
32
32
import com .fasterxml .jackson .core .io .SerializedString ;
33
- import com .fasterxml .jackson .core .util .DefaultPrettyPrinter ;
34
33
import com .fasterxml .jackson .dataformat .yaml .YAMLFactory ;
35
34
import com .fasterxml .jackson .dataformat .yaml .YAMLGenerator ;
36
35
47
46
* @author Jens Wille
48
47
*
49
48
*/
50
- @ Description ("Serialises an object as YAML" )
49
+ @ Description ("Serialises an object as YAML. The paramter 'prettyprinting (boolean)' is deprecated since it's not possible to not pretty print. " )
51
50
@ In (StreamReceiver .class )
52
51
@ Out (String .class )
53
52
@ FluxCommand ("encode-yaml" )
@@ -95,20 +94,27 @@ public String getArrayMarker() {
95
94
96
95
/**
97
96
* Flags whether the data should be pretty printed.
97
+ * @deprecated
98
+ * Jackson's YAMLGenerator ignores any PrettyPrinter. It's always
99
+ * pretty printed.
98
100
*
99
101
* @param prettyPrinting true if the data should be pretty printed
100
102
*/
103
+ @ Deprecated
101
104
public void setPrettyPrinting (final boolean prettyPrinting ) {
102
- yamlGenerator .setPrettyPrinter (prettyPrinting ? new DefaultPrettyPrinter ((SerializableString ) null ) : null );
103
105
}
104
106
105
107
/**
106
108
* Checks whether to pretty print.
109
+ * @deprecated
110
+ * Jackson's YAMLGenerator ignores any PrettyPrinter. It's always
111
+ * pretty printed.
107
112
*
108
113
* @return true if the data should be pretty printed
109
114
*/
115
+ @ Deprecated
110
116
public boolean getPrettyPrinting () {
111
- return yamlGenerator . getPrettyPrinter () != null ;
117
+ return true ;
112
118
}
113
119
114
120
/**
Original file line number Diff line number Diff line change @@ -273,27 +273,6 @@ public void testShouldPrefixOutputWithNewline() {
273
273
);
274
274
}
275
275
276
- @ Test
277
- public void testShouldPrefixPrettyPrintedOutputWithNewline () {
278
- assertEncode (
279
- i -> {
280
- i .setPrettyPrinting (true );
281
-
282
- i .startRecord ("" );
283
- i .literal (LITERAL1 , VALUE1 );
284
- i .endRecord ();
285
- i .startRecord ("" );
286
- i .literal (LITERAL2 , VALUE2 );
287
- i .endRecord ();
288
- },
289
- "---\n " +
290
- "L1: 'V1'" ,
291
- "\n " +
292
- "---\n " +
293
- "L2: 'V2'"
294
- );
295
- }
296
-
297
276
private void assertEncode (final Consumer <YamlEncoder > in , final String ... out ) {
298
277
final InOrder ordered = Mockito .inOrder (receiver );
299
278
You can’t perform that action at this time.
0 commit comments