1 package org.apache.maven.model.io.xpp3;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.IOException;
23 import java.io.OutputStream;
24 import java.io.Writer;
25
26 import org.apache.maven.model.InputLocation;
27 import org.apache.maven.model.Model;
28
29 public class MavenXpp3WriterEx
30 {
31
32
33
34
35
36
37
38 private String fileComment = null;
39
40
41
42
43 protected InputLocation.StringFormatter stringFormatter;
44
45
46
47
48
49
50
51
52
53
54
55 public void setFileComment( String fileComment )
56 {
57 this.fileComment = fileComment;
58 }
59
60
61
62
63
64
65 public void setStringFormatter( InputLocation.StringFormatter stringFormatter )
66 {
67 this.stringFormatter = stringFormatter;
68 }
69
70
71
72
73
74
75
76
77 public void write( Writer writer, Model model )
78 throws IOException
79 {
80 org.apache.maven.model.v4.MavenXpp3WriterEx xw = new org.apache.maven.model.v4.MavenXpp3WriterEx();
81 xw.setFileComment( fileComment );
82 xw.setStringFormatter( stringFormatter != null ? new org.apache.maven.api.model.InputLocation.StringFormatter()
83 {
84 @Override
85 public String toString( org.apache.maven.api.model.InputLocation location )
86 {
87 return stringFormatter.toString( new InputLocation( location ) );
88 }
89 } : null );
90 xw.write( writer, model.getDelegate() );
91 }
92
93
94
95
96
97
98
99
100 public void write( OutputStream stream, Model model )
101 throws IOException
102 {
103 org.apache.maven.model.v4.MavenXpp3WriterEx xw = new org.apache.maven.model.v4.MavenXpp3WriterEx();
104 xw.setFileComment( fileComment );
105 xw.write( stream, model.getDelegate() );
106 }
107
108 }