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 3030import com .fasterxml .jackson .core .SerializableString ;
3131import com .fasterxml .jackson .core .io .CharacterEscapes ;
3232import com .fasterxml .jackson .core .io .SerializedString ;
33- import com .fasterxml .jackson .core .util .DefaultPrettyPrinter ;
3433import com .fasterxml .jackson .dataformat .yaml .YAMLFactory ;
3534import com .fasterxml .jackson .dataformat .yaml .YAMLGenerator ;
3635
4746 * @author Jens Wille
4847 *
4948 */
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. " )
5150@ In (StreamReceiver .class )
5251@ Out (String .class )
5352@ FluxCommand ("encode-yaml" )
@@ -95,20 +94,27 @@ public String getArrayMarker() {
9594
9695 /**
9796 * Flags whether the data should be pretty printed.
97+ * @deprecated
98+ * Jackson's YAMLGenerator ignores any PrettyPrinter. It's always
99+ * pretty printed.
98100 *
99101 * @param prettyPrinting true if the data should be pretty printed
100102 */
103+ @ Deprecated
101104 public void setPrettyPrinting (final boolean prettyPrinting ) {
102- yamlGenerator .setPrettyPrinter (prettyPrinting ? new DefaultPrettyPrinter ((SerializableString ) null ) : null );
103105 }
104106
105107 /**
106108 * Checks whether to pretty print.
109+ * @deprecated
110+ * Jackson's YAMLGenerator ignores any PrettyPrinter. It's always
111+ * pretty printed.
107112 *
108113 * @return true if the data should be pretty printed
109114 */
115+ @ Deprecated
110116 public boolean getPrettyPrinting () {
111- return yamlGenerator . getPrettyPrinter () != null ;
117+ return true ;
112118 }
113119
114120 /**
Original file line number Diff line number Diff line change @@ -273,27 +273,6 @@ public void testShouldPrefixOutputWithNewline() {
273273 );
274274 }
275275
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-
297276 private void assertEncode (final Consumer <YamlEncoder > in , final String ... out ) {
298277 final InOrder ordered = Mockito .inOrder (receiver );
299278
You can’t perform that action at this time.
0 commit comments