1 /*
2 * $Id$
3 */
4
5 package org.apache.maven.model;
6
7 //---------------------------------/
8 //- Imported classes and packages -/
9 //---------------------------------/
10
11 import java.util.Date;
12
13 /**
14 * Represents a set of reports and configuration to be used to
15 * generate them.
16 *
17 * @version $Revision$ $Date$
18 */
19 public class ReportSet implements java.io.Serializable {
20
21
22 //--------------------------/
23 //- Class/Member Variables -/
24 //--------------------------/
25
26 /**
27 * The unique id for this report set, to be used during POM
28 * inheritance.
29 */
30 private String id = "default";
31
32 /**
33 * Configuration of the report to be used when generating this
34 * set.
35 */
36 private Object configuration;
37
38 /**
39 * Whether any configuration should be propagated to child POMs.
40 */
41 private String inherited;
42
43 /**
44 * Field reports.
45 */
46 private java.util.List reports;
47
48
49 //-----------/
50 //- Methods -/
51 //-----------/
52
53 /**
54 * Method addReport.
55 *
56 * @param string
57 */
58 public void addReport( String string )
59 {
60 if ( !(string instanceof String) )
61 {
62 throw new ClassCastException( "ReportSet.addReports(string) parameter must be instanceof " + String.class.getName() );
63 }
64 getReports().add( string );
65 } //-- void addReport( String )
66
67 /**
68 * Get configuration of the report to be used when generating
69 * this set.
70 *
71 * @return Object
72 */
73 public Object getConfiguration()
74 {
75 return this.configuration;
76 } //-- Object getConfiguration()
77
78 /**
79 * Get the unique id for this report set, to be used during POM
80 * inheritance.
81 *
82 * @return String
83 */
84 public String getId()
85 {
86 return this.id;
87 } //-- String getId()
88
89 /**
90 * Get whether any configuration should be propagated to child
91 * POMs.
92 *
93 * @return String
94 */
95 public String getInherited()
96 {
97 return this.inherited;
98 } //-- String getInherited()
99
100 /**
101 * Method getReports.
102 *
103 * @return java.util.List
104 */
105 public java.util.List getReports()
106 {
107 if ( this.reports == null )
108 {
109 this.reports = new java.util.ArrayList();
110 }
111
112 return this.reports;
113 } //-- java.util.List getReports()
114
115 /**
116 * Method removeReport.
117 *
118 * @param string
119 */
120 public void removeReport( String string )
121 {
122 if ( !(string instanceof String) )
123 {
124 throw new ClassCastException( "ReportSet.removeReports(string) parameter must be instanceof " + String.class.getName() );
125 }
126 getReports().remove( string );
127 } //-- void removeReport( String )
128
129 /**
130 * Set configuration of the report to be used when generating
131 * this set.
132 *
133 * @param configuration
134 */
135 public void setConfiguration( Object configuration )
136 {
137 this.configuration = configuration;
138 } //-- void setConfiguration( Object )
139
140 /**
141 * Set the unique id for this report set, to be used during POM
142 * inheritance.
143 *
144 * @param id
145 */
146 public void setId( String id )
147 {
148 this.id = id;
149 } //-- void setId( String )
150
151 /**
152 * Set whether any configuration should be propagated to child
153 * POMs.
154 *
155 * @param inherited
156 */
157 public void setInherited( String inherited )
158 {
159 this.inherited = inherited;
160 } //-- void setInherited( String )
161
162 /**
163 * Set the list of reports from this plugin which should be
164 * generated from this set.
165 *
166 * @param reports
167 */
168 public void setReports( java.util.List reports )
169 {
170 this.reports = reports;
171 } //-- void setReports( java.util.List )
172
173
174
175 private boolean inheritanceApplied = true;
176
177 public void unsetInheritanceApplied()
178 {
179 this.inheritanceApplied = false;
180 }
181
182 public boolean isInheritanceApplied()
183 {
184 return inheritanceApplied;
185 }
186
187
188 private String modelEncoding = "UTF-8";
189
190 /**
191 * Set an encoding used for reading/writing the model.
192 *
193 * @param modelEncoding the encoding used when reading/writing the model.
194 */
195 public void setModelEncoding( String modelEncoding )
196 {
197 this.modelEncoding = modelEncoding;
198 }
199
200 /**
201 * @return the current encoding used when reading/writing this model.
202 */
203 public String getModelEncoding()
204 {
205 return modelEncoding;
206 }
207 }