33import ch .jalu .configme .configurationdata .ConfigurationData ;
44import ch .jalu .configme .internal .StreamUtils ;
55import ch .jalu .configme .properties .convertresult .ValueWithComments ;
6-
76import org .jetbrains .annotations .NotNull ;
8- import org .yaml .snakeyaml .DumperOptions ;
9- import org .yaml .snakeyaml .comments .CommentLine ;
10- import org .yaml .snakeyaml .comments .CommentType ;
11- import org .yaml .snakeyaml .nodes .MappingNode ;
12- import org .yaml .snakeyaml .nodes .Node ;
13- import org .yaml .snakeyaml .nodes .NodeTuple ;
14- import org .yaml .snakeyaml .nodes .ScalarNode ;
15- import org .yaml .snakeyaml .nodes .SequenceNode ;
16- import org .yaml .snakeyaml .nodes .Tag ;
7+ import org .snakeyaml .engine .v2 .comments .CommentLine ;
8+ import org .snakeyaml .engine .v2 .comments .CommentType ;
9+ import org .snakeyaml .engine .v2 .common .FlowStyle ;
10+ import org .snakeyaml .engine .v2 .common .ScalarStyle ;
11+ import org .snakeyaml .engine .v2 .nodes .MappingNode ;
12+ import org .snakeyaml .engine .v2 .nodes .Node ;
13+ import org .snakeyaml .engine .v2 .nodes .NodeTuple ;
14+ import org .snakeyaml .engine .v2 .nodes .ScalarNode ;
15+ import org .snakeyaml .engine .v2 .nodes .SequenceNode ;
16+ import org .snakeyaml .engine .v2 .nodes .Tag ;
1717
1818import java .math .BigDecimal ;
1919import java .util .ArrayList ;
2222import java .util .HashSet ;
2323import java .util .List ;
2424import java .util .Map ;
25+ import java .util .Optional ;
2526import java .util .Set ;
2627import java .util .UUID ;
2728import java .util .concurrent .atomic .AtomicInteger ;
@@ -82,11 +83,11 @@ public class SnakeYamlNodeBuilderImpl implements SnakeYamlNodeBuilder {
8283 @ Override
8384 public @ NotNull Stream <CommentLine > createCommentLines (@ NotNull String comment ) {
8485 if ("\n " .equals (comment )) {
85- return Stream .of (new CommentLine (null , null , "" , CommentType .BLANK_LINE ));
86+ return Stream .of (new CommentLine (Optional . empty (), Optional . empty () , "" , CommentType .BLANK_LINE ));
8687 }
8788
8889 return Arrays .stream (comment .split ("\\ n" , -1 ))
89- .map (text -> new CommentLine (null , null , " " .concat (text ), CommentType .BLOCK ));
90+ .map (text -> new CommentLine (Optional . empty (), Optional . empty () , " " .concat (text ), CommentType .BLOCK ));
9091 }
9192
9293 @ Override
@@ -98,21 +99,21 @@ public void transferComments(@NotNull Node valueNode, @NotNull Node keyNode) {
9899 }
99100
100101 protected @ NotNull Node createStringNode (@ NotNull String value ) {
101- DumperOptions . ScalarStyle scalarStyle = value .contains ("\n " )
102- ? DumperOptions . ScalarStyle .LITERAL // Used for strings that span multiple lines
103- : DumperOptions . ScalarStyle .PLAIN ; // Used for single line string
104- return new ScalarNode (Tag .STR , value , null , null , scalarStyle );
102+ ScalarStyle scalarStyle = value .contains ("\n " )
103+ ? ScalarStyle .LITERAL // Used for strings that span multiple lines
104+ : ScalarStyle .PLAIN ; // Used for single line string
105+ return new ScalarNode (Tag .STR , value , scalarStyle );
105106 }
106107
107108 protected @ NotNull Node createNumberNode (@ NotNull Number value ) {
108109 Tag tag = (value instanceof Double || value instanceof Float || value instanceof BigDecimal )
109110 ? Tag .FLOAT
110111 : Tag .INT ;
111- return new ScalarNode (tag , value .toString (), null , null , DumperOptions . ScalarStyle .PLAIN );
112+ return new ScalarNode (tag , value .toString (), ScalarStyle .PLAIN );
112113 }
113114
114115 protected @ NotNull Node createBooleanNode (boolean value ) {
115- return new ScalarNode (Tag .BOOL , String .valueOf (value ), null , null , DumperOptions . ScalarStyle .PLAIN );
116+ return new ScalarNode (Tag .BOOL , String .valueOf (value ), ScalarStyle .PLAIN );
116117 }
117118
118119 /**
@@ -134,7 +135,7 @@ public void transferComments(@NotNull Node valueNode, @NotNull Node keyNode) {
134135 })
135136 .collect (Collectors .toList ());
136137
137- return new SequenceNode (Tag .SEQ , values , DumperOptions . FlowStyle .BLOCK );
138+ return new SequenceNode (Tag .SEQ , values , FlowStyle .BLOCK );
138139 }
139140
140141 /**
@@ -158,7 +159,7 @@ public void transferComments(@NotNull Node valueNode, @NotNull Node keyNode) {
158159 nodeEntries .add (new NodeTuple (keyNode , valueNode ));
159160 }
160161
161- return new MappingNode (Tag .MAP , nodeEntries , DumperOptions . FlowStyle .BLOCK );
162+ return new MappingNode (Tag .MAP , nodeEntries , FlowStyle .BLOCK );
162163 }
163164
164165 /**
0 commit comments