View Javadoc

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   * Description of a person who has contributed to the project, but
15   * who does not have
16   *         commit privileges. Usually, these contributions come in
17   * the form of patches submitted.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class Contributor implements java.io.Serializable {
22  
23  
24        //--------------------------/
25       //- Class/Member Variables -/
26      //--------------------------/
27  
28      /**
29       * The full name of the contributor.
30       */
31      private String name;
32  
33      /**
34       * The email address of the contributor.
35       */
36      private String email;
37  
38      /**
39       * The URL for the homepage of the contributor.
40       */
41      private String url;
42  
43      /**
44       * The organization to which the contributor belongs.
45       */
46      private String organization;
47  
48      /**
49       * The URL of the organization.
50       */
51      private String organizationUrl;
52  
53      /**
54       * Field roles.
55       */
56      private java.util.List roles;
57  
58      /**
59       * The timezone the contributor is in. This is a number in the
60       * range -11 to 12.
61       */
62      private String timezone;
63  
64      /**
65       * Field properties.
66       */
67      private java.util.Properties properties;
68  
69  
70        //-----------/
71       //- Methods -/
72      //-----------/
73  
74      /**
75       * Method addProperty.
76       * 
77       * @param key
78       * @param value
79       */
80      public void addProperty( String key, String value )
81      {
82          getProperties().put( key, value );
83      } //-- void addProperty( String, String ) 
84  
85      /**
86       * Method addRole.
87       * 
88       * @param string
89       */
90      public void addRole( String string )
91      {
92          if ( !(string instanceof String) )
93          {
94              throw new ClassCastException( "Contributor.addRoles(string) parameter must be instanceof " + String.class.getName() );
95          }
96          getRoles().add( string );
97      } //-- void addRole( String ) 
98  
99      /**
100      * Get the email address of the contributor.
101      * 
102      * @return String
103      */
104     public String getEmail()
105     {
106         return this.email;
107     } //-- String getEmail() 
108 
109     /**
110      * Get the full name of the contributor.
111      * 
112      * @return String
113      */
114     public String getName()
115     {
116         return this.name;
117     } //-- String getName() 
118 
119     /**
120      * Get the organization to which the contributor belongs.
121      * 
122      * @return String
123      */
124     public String getOrganization()
125     {
126         return this.organization;
127     } //-- String getOrganization() 
128 
129     /**
130      * Get the URL of the organization.
131      * 
132      * @return String
133      */
134     public String getOrganizationUrl()
135     {
136         return this.organizationUrl;
137     } //-- String getOrganizationUrl() 
138 
139     /**
140      * Method getProperties.
141      * 
142      * @return java.util.Properties
143      */
144     public java.util.Properties getProperties()
145     {
146         if ( this.properties == null )
147         {
148             this.properties = new java.util.Properties();
149         }
150     
151         return this.properties;
152     } //-- java.util.Properties getProperties() 
153 
154     /**
155      * Method getRoles.
156      * 
157      * @return java.util.List
158      */
159     public java.util.List getRoles()
160     {
161         if ( this.roles == null )
162         {
163             this.roles = new java.util.ArrayList();
164         }
165     
166         return this.roles;
167     } //-- java.util.List getRoles() 
168 
169     /**
170      * Get the timezone the contributor is in. This is a number in
171      * the range -11 to 12.
172      * 
173      * @return String
174      */
175     public String getTimezone()
176     {
177         return this.timezone;
178     } //-- String getTimezone() 
179 
180     /**
181      * Get the URL for the homepage of the contributor.
182      * 
183      * @return String
184      */
185     public String getUrl()
186     {
187         return this.url;
188     } //-- String getUrl() 
189 
190     /**
191      * Method removeRole.
192      * 
193      * @param string
194      */
195     public void removeRole( String string )
196     {
197         if ( !(string instanceof String) )
198         {
199             throw new ClassCastException( "Contributor.removeRoles(string) parameter must be instanceof " + String.class.getName() );
200         }
201         getRoles().remove( string );
202     } //-- void removeRole( String ) 
203 
204     /**
205      * Set the email address of the contributor.
206      * 
207      * @param email
208      */
209     public void setEmail( String email )
210     {
211         this.email = email;
212     } //-- void setEmail( String ) 
213 
214     /**
215      * Set the full name of the contributor.
216      * 
217      * @param name
218      */
219     public void setName( String name )
220     {
221         this.name = name;
222     } //-- void setName( String ) 
223 
224     /**
225      * Set the organization to which the contributor belongs.
226      * 
227      * @param organization
228      */
229     public void setOrganization( String organization )
230     {
231         this.organization = organization;
232     } //-- void setOrganization( String ) 
233 
234     /**
235      * Set the URL of the organization.
236      * 
237      * @param organizationUrl
238      */
239     public void setOrganizationUrl( String organizationUrl )
240     {
241         this.organizationUrl = organizationUrl;
242     } //-- void setOrganizationUrl( String ) 
243 
244     /**
245      * Set properties about the contributor, such as an instant
246      * messenger handle.
247      * 
248      * @param properties
249      */
250     public void setProperties( java.util.Properties properties )
251     {
252         this.properties = properties;
253     } //-- void setProperties( java.util.Properties ) 
254 
255     /**
256      * Set 
257      *             
258      *             The roles the contributor plays in the project.
259      * Each role is described by a
260      *             <code>role</code> element, the body of which is
261      * a role name. This can also be used to
262      *             describe the contribution.
263      *             
264      *           
265      * 
266      * @param roles
267      */
268     public void setRoles( java.util.List roles )
269     {
270         this.roles = roles;
271     } //-- void setRoles( java.util.List ) 
272 
273     /**
274      * Set the timezone the contributor is in. This is a number in
275      * the range -11 to 12.
276      * 
277      * @param timezone
278      */
279     public void setTimezone( String timezone )
280     {
281         this.timezone = timezone;
282     } //-- void setTimezone( String ) 
283 
284     /**
285      * Set the URL for the homepage of the contributor.
286      * 
287      * @param url
288      */
289     public void setUrl( String url )
290     {
291         this.url = url;
292     } //-- void setUrl( String ) 
293 
294 
295     private String modelEncoding = "UTF-8";
296 
297     /**
298      * Set an encoding used for reading/writing the model.
299      *
300      * @param modelEncoding the encoding used when reading/writing the model.
301      */
302     public void setModelEncoding( String modelEncoding )
303     {
304         this.modelEncoding = modelEncoding;
305     }
306 
307     /**
308      * @return the current encoding used when reading/writing this model.
309      */
310     public String getModelEncoding()
311     {
312         return modelEncoding;
313     }
314 }