1 /*
2 * $Id$
3 */
4
5 package org.apache.maven.usability.plugin;
6
7 //---------------------------------/
8 //- Imported classes and packages -/
9 //---------------------------------/
10
11 import java.util.Date;
12
13 /**
14 * A plugin parameter expression supported by Maven.
15 *
16 * @version $Revision$ $Date$
17 */
18 public class Expression implements java.io.Serializable {
19
20
21 //--------------------------/
22 //- Class/Member Variables -/
23 //--------------------------/
24
25 /**
26 * The syntax of the expression.
27 */
28 private String syntax;
29
30 /**
31 * The description of what this expression references, and what
32 * it's generally used for.
33 */
34 private String description;
35
36 /**
37 * The place and syntax used to change the value of this
38 * expression.
39 */
40 private String configuration;
41
42 /**
43 * Field cliOptions.
44 */
45 private java.util.Properties cliOptions;
46
47 /**
48 * Field apiMethods.
49 */
50 private java.util.Properties apiMethods;
51
52 /**
53 * A preferred alternative to this expression, in the case
54 * where it's deprecated.
55 */
56 private String deprecation;
57
58 /**
59 * A preferred alternative to this expression, in the case
60 * where it's banned from use.
61 */
62 private String ban;
63
64 /**
65 * Whether the value of this expression can be changed.
66 */
67 private boolean editable = true;
68
69
70 //-----------/
71 //- Methods -/
72 //-----------/
73
74 /**
75 * Method addApiMethod.
76 *
77 * @param key
78 * @param value
79 */
80 public void addApiMethod( String key, String value )
81 {
82 getApiMethods().put( key, value );
83 } //-- void addApiMethod( String, String )
84
85 /**
86 * Method addCliOption.
87 *
88 * @param key
89 * @param value
90 */
91 public void addCliOption( String key, String value )
92 {
93 getCliOptions().put( key, value );
94 } //-- void addCliOption( String, String )
95
96 /**
97 * Method getApiMethods.
98 *
99 * @return java.util.Properties
100 */
101 public java.util.Properties getApiMethods()
102 {
103 if ( this.apiMethods == null )
104 {
105 this.apiMethods = new java.util.Properties();
106 }
107
108 return this.apiMethods;
109 } //-- java.util.Properties getApiMethods()
110
111 /**
112 * Get a preferred alternative to this expression, in the case
113 * where it's banned from use.
114 *
115 * @return String
116 */
117 public String getBan()
118 {
119 return this.ban;
120 } //-- String getBan()
121
122 /**
123 * Method getCliOptions.
124 *
125 * @return java.util.Properties
126 */
127 public java.util.Properties getCliOptions()
128 {
129 if ( this.cliOptions == null )
130 {
131 this.cliOptions = new java.util.Properties();
132 }
133
134 return this.cliOptions;
135 } //-- java.util.Properties getCliOptions()
136
137 /**
138 * Get the place and syntax used to change the value of this
139 * expression.
140 *
141 * @return String
142 */
143 public String getConfiguration()
144 {
145 return this.configuration;
146 } //-- String getConfiguration()
147
148 /**
149 * Get a preferred alternative to this expression, in the case
150 * where it's deprecated.
151 *
152 * @return String
153 */
154 public String getDeprecation()
155 {
156 return this.deprecation;
157 } //-- String getDeprecation()
158
159 /**
160 * Get the description of what this expression references, and
161 * what it's generally used for.
162 *
163 * @return String
164 */
165 public String getDescription()
166 {
167 return this.description;
168 } //-- String getDescription()
169
170 /**
171 * Get the syntax of the expression.
172 *
173 * @return String
174 */
175 public String getSyntax()
176 {
177 return this.syntax;
178 } //-- String getSyntax()
179
180 /**
181 * Get whether the value of this expression can be changed.
182 *
183 * @return boolean
184 */
185 public boolean isEditable()
186 {
187 return this.editable;
188 } //-- boolean isEditable()
189
190 /**
191 * Set the programmatic methods used to change the value of
192 * this expression.
193 *
194 * @param apiMethods
195 */
196 public void setApiMethods( java.util.Properties apiMethods )
197 {
198 this.apiMethods = apiMethods;
199 } //-- void setApiMethods( java.util.Properties )
200
201 /**
202 * Set a preferred alternative to this expression, in the case
203 * where it's banned from use.
204 *
205 * @param ban
206 */
207 public void setBan( String ban )
208 {
209 this.ban = ban;
210 } //-- void setBan( String )
211
212 /**
213 * Set the command-line switches used to change the value of
214 * this expression.
215 *
216 * @param cliOptions
217 */
218 public void setCliOptions( java.util.Properties cliOptions )
219 {
220 this.cliOptions = cliOptions;
221 } //-- void setCliOptions( java.util.Properties )
222
223 /**
224 * Set the place and syntax used to change the value of this
225 * expression.
226 *
227 * @param configuration
228 */
229 public void setConfiguration( String configuration )
230 {
231 this.configuration = configuration;
232 } //-- void setConfiguration( String )
233
234 /**
235 * Set a preferred alternative to this expression, in the case
236 * where it's deprecated.
237 *
238 * @param deprecation
239 */
240 public void setDeprecation( String deprecation )
241 {
242 this.deprecation = deprecation;
243 } //-- void setDeprecation( String )
244
245 /**
246 * Set the description of what this expression references, and
247 * what it's generally used for.
248 *
249 * @param description
250 */
251 public void setDescription( String description )
252 {
253 this.description = description;
254 } //-- void setDescription( String )
255
256 /**
257 * Set whether the value of this expression can be changed.
258 *
259 * @param editable
260 */
261 public void setEditable( boolean editable )
262 {
263 this.editable = editable;
264 } //-- void setEditable( boolean )
265
266 /**
267 * Set the syntax of the expression.
268 *
269 * @param syntax
270 */
271 public void setSyntax( String syntax )
272 {
273 this.syntax = syntax;
274 } //-- void setSyntax( String )
275
276
277 private String modelEncoding = "UTF-8";
278
279 /**
280 * Set an encoding used for reading/writing the model.
281 *
282 * @param modelEncoding the encoding used when reading/writing the model.
283 */
284 public void setModelEncoding( String modelEncoding )
285 {
286 this.modelEncoding = modelEncoding;
287 }
288
289 /**
290 * @return the current encoding used when reading/writing this model.
291 */
292 public String getModelEncoding()
293 {
294 return modelEncoding;
295 }
296 }