1
1
package ch .ergon .adam .yml ;
2
2
3
+ import ch .ergon .adam .core .db .interfaces .SchemaSink ;
3
4
import ch .ergon .adam .core .db .schema .*;
4
5
import ch .ergon .adam .yml .schema .*;
5
- import ch .ergon .adam .core .db .interfaces .SchemaSink ;
6
6
import com .fasterxml .jackson .databind .MapperFeature ;
7
7
import com .fasterxml .jackson .databind .ObjectMapper ;
8
- import com .fasterxml .jackson .dataformat .yaml .YAMLFactory ;
8
+ import com .fasterxml .jackson .dataformat .yaml .YAMLMapper ;
9
9
10
10
import java .io .File ;
11
11
import java .io .IOException ;
@@ -24,26 +24,28 @@ public class YmlSink implements SchemaSink {
24
24
private final File targetPath ;
25
25
private final OutputStream outputStream ;
26
26
private final ObjectMapper mapper ;
27
- private Set <Table > updatedTables = new HashSet <>();
28
- private Set <Table > droppedTables = new HashSet <>();
29
- private Set <View > updatedViews = new HashSet <>();
30
- private Set <View > droppedViews = new HashSet <>();
27
+ private final Set <Table > updatedTables = new HashSet <>();
28
+ private final Set <Table > droppedTables = new HashSet <>();
29
+ private final Set <View > updatedViews = new HashSet <>();
30
+ private final Set <View > droppedViews = new HashSet <>();
31
31
private Schema targetSchema ;
32
32
33
33
public YmlSink (File targetPath ) {
34
34
this .targetPath = targetPath ;
35
35
this .outputStream = null ;
36
- mapper = new ObjectMapper (new YAMLFactory ());
37
- mapper .configure (MapperFeature .SORT_PROPERTIES_ALPHABETICALLY , true );
38
- mapper .setSerializationInclusion (NON_DEFAULT );
36
+ mapper = YAMLMapper .builder ()
37
+ .enable (MapperFeature .SORT_PROPERTIES_ALPHABETICALLY )
38
+ .serializationInclusion (NON_DEFAULT )
39
+ .build ();
39
40
}
40
41
41
42
public YmlSink (OutputStream outputStream ) {
42
43
this .targetPath = null ;
43
44
this .outputStream = outputStream ;
44
- mapper = new ObjectMapper (new YAMLFactory ());
45
- mapper .configure (MapperFeature .SORT_PROPERTIES_ALPHABETICALLY , true );
46
- mapper .setSerializationInclusion (NON_DEFAULT );
45
+ mapper = YAMLMapper .builder ()
46
+ .enable (MapperFeature .SORT_PROPERTIES_ALPHABETICALLY )
47
+ .serializationInclusion (NON_DEFAULT )
48
+ .build ();
47
49
}
48
50
49
51
@ Override
0 commit comments