View Javadoc
1   /*
2    Licensed to the Apache Software Foundation (ASF) under one
3    or more contributor license agreements.  See the NOTICE file
4    distributed with this work for additional information
5    regarding copyright ownership.  The ASF licenses this file
6    to you under the Apache License, Version 2.0 (the
7    "License"); you may not use this file except in compliance
8    with the License.  You may obtain a copy of the License at
9    
10       http://www.apache.org/licenses/LICENSE-2.0
11   
12   Unless required by applicable law or agreed to in writing,
13   software distributed under the License is distributed on an
14   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   KIND, either express or implied.  See the License for the
16   specific language governing permissions and limitations
17   under the License.
18   =================== DO NOT EDIT THIS FILE ====================
19   Generated by Modello 2.4.0,
20   any modifications will be overwritten.
21   ==============================================================
22   */
23  
24  package org.apache.maven.model;
25  
26  /**
27   * Describes the licenses for this project. This is used to
28   * generate the license
29   *         page of the project's web site, as well as being taken
30   * into consideration in other reporting
31   *         and validation. The licenses listed for the project are
32   * that of the project itself, and not
33   *         of dependencies.
34   * 
35   * @version $Revision$ $Date$
36   */
37  @SuppressWarnings( "all" )
38  public class License
39      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
40  {
41  
42        //--------------------------/
43       //- Class/Member Variables -/
44      //--------------------------/
45  
46      /**
47       * The full legal name of the license.
48       */
49      private String name;
50  
51      /**
52       * The official url for the license text.
53       */
54      private String url;
55  
56      /**
57       * 
58       *             
59       *             The primary method by which this project may be
60       * distributed.
61       *             <dl>
62       *               <dt>repo</dt>
63       *               <dd>may be downloaded from the Maven
64       * repository</dd>
65       *               <dt>manual</dt>
66       *               <dd>user must manually download and install
67       * the dependency.</dd>
68       *             </dl>
69       *             
70       *           
71       */
72      private String distribution;
73  
74      /**
75       * Addendum information pertaining to this license.
76       */
77      private String comments;
78  
79      /**
80       * Field locations.
81       */
82      private java.util.Map<Object, InputLocation> locations;
83  
84      /**
85       * Field location.
86       */
87      private InputLocation location;
88  
89      /**
90       * Field nameLocation.
91       */
92      private InputLocation nameLocation;
93  
94      /**
95       * Field urlLocation.
96       */
97      private InputLocation urlLocation;
98  
99      /**
100      * Field distributionLocation.
101      */
102     private InputLocation distributionLocation;
103 
104     /**
105      * Field commentsLocation.
106      */
107     private InputLocation commentsLocation;
108 
109 
110       //-----------/
111      //- Methods -/
112     //-----------/
113 
114     /**
115      * Method clone.
116      * 
117      * @return License
118      */
119     public License clone()
120     {
121         try
122         {
123             License copy = (License) super.clone();
124 
125             if ( copy.locations != null )
126             {
127                 copy.locations = new java.util.LinkedHashMap( copy.locations );
128             }
129 
130             return copy;
131         }
132         catch ( java.lang.Exception ex )
133         {
134             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
135                 + " does not support clone()" ).initCause( ex );
136         }
137     } //-- License clone()
138 
139     /**
140      * Get addendum information pertaining to this license.
141      * 
142      * @return String
143      */
144     public String getComments()
145     {
146         return this.comments;
147     } //-- String getComments()
148 
149     /**
150      * Get the primary method by which this project may be
151      * distributed.
152      *             <dl>
153      *               <dt>repo</dt>
154      *               <dd>may be downloaded from the Maven
155      * repository</dd>
156      *               <dt>manual</dt>
157      *               <dd>user must manually download and install
158      * the dependency.</dd>
159      *             </dl>
160      * 
161      * @return String
162      */
163     public String getDistribution()
164     {
165         return this.distribution;
166     } //-- String getDistribution()
167 
168     /**
169      * 
170      * 
171      * @param key a key object.
172      * @return InputLocation
173      */
174     public InputLocation getLocation( Object key )
175     {
176         if ( key instanceof String )
177         {
178             switch ( ( String ) key )
179             {
180                 case "" :
181                 {
182                     return this.location;
183                 }
184                 case "name" :
185                 {
186                     return nameLocation;
187                 }
188                 case "url" :
189                 {
190                     return urlLocation;
191                 }
192                 case "distribution" :
193                 {
194                     return distributionLocation;
195                 }
196                 case "comments" :
197                 {
198                     return commentsLocation;
199                 }
200                 default :
201                 {
202                     return getOtherLocation( key );
203                 }
204                 }
205             }
206             else
207             {
208                 return getOtherLocation( key );
209             }
210     } //-- InputLocation getLocation( Object )
211 
212     /**
213      * Get the full legal name of the license.
214      * 
215      * @return String
216      */
217     public String getName()
218     {
219         return this.name;
220     } //-- String getName()
221 
222     /**
223      * 
224      * 
225      * @param key a key object.
226      * @param location a location object.
227      */
228     public void setLocation( Object key, InputLocation location )
229     {
230         if ( key instanceof String )
231         {
232             switch ( ( String ) key )
233             {
234                 case "" :
235                 {
236                     this.location = location;
237                     return;
238                 }
239                 case "name" :
240                 {
241                     nameLocation = location;
242                     return;
243                 }
244                 case "url" :
245                 {
246                     urlLocation = location;
247                     return;
248                 }
249                 case "distribution" :
250                 {
251                     distributionLocation = location;
252                     return;
253                 }
254                 case "comments" :
255                 {
256                     commentsLocation = location;
257                     return;
258                 }
259                 default :
260                 {
261                     setOtherLocation( key, location );
262                     return;
263                 }
264             }
265         }
266         else
267         {
268             setOtherLocation( key, location );
269         }
270     } //-- void setLocation( Object, InputLocation )
271 
272     /**
273      * 
274      * 
275      * @param key a key object.
276      * @param location a location object.
277      */
278     public void setOtherLocation( Object key, InputLocation location )
279     {
280         if ( location != null )
281         {
282             if ( this.locations == null )
283             {
284                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
285             }
286             this.locations.put( key, location );
287         }
288     } //-- void setOtherLocation( Object, InputLocation )
289 
290     /**
291      * 
292      * 
293      * @param key a key object.
294      * @return InputLocation
295      */
296     private InputLocation getOtherLocation( Object key )
297     {
298         return ( locations != null ) ? locations.get( key ) : null;
299     } //-- InputLocation getOtherLocation( Object )
300 
301     /**
302      * Get the official url for the license text.
303      * 
304      * @return String
305      */
306     public String getUrl()
307     {
308         return this.url;
309     } //-- String getUrl()
310 
311     /**
312      * Set addendum information pertaining to this license.
313      * 
314      * @param comments a comments object.
315      */
316     public void setComments( String comments )
317     {
318         this.comments = comments;
319     } //-- void setComments( String )
320 
321     /**
322      * Set the primary method by which this project may be
323      * distributed.
324      *             <dl>
325      *               <dt>repo</dt>
326      *               <dd>may be downloaded from the Maven
327      * repository</dd>
328      *               <dt>manual</dt>
329      *               <dd>user must manually download and install
330      * the dependency.</dd>
331      *             </dl>
332      * 
333      * @param distribution a distribution object.
334      */
335     public void setDistribution( String distribution )
336     {
337         this.distribution = distribution;
338     } //-- void setDistribution( String )
339 
340     /**
341      * Set the full legal name of the license.
342      * 
343      * @param name a name object.
344      */
345     public void setName( String name )
346     {
347         this.name = name;
348     } //-- void setName( String )
349 
350     /**
351      * Set the official url for the license text.
352      * 
353      * @param url a url object.
354      */
355     public void setUrl( String url )
356     {
357         this.url = url;
358     } //-- void setUrl( String )
359 
360     
361             
362     /**
363      * @see java.lang.Object#toString()
364      */
365     public String toString()
366     {
367         return "License {name=" + name + ", url=" + url + "}";
368     }
369             
370           
371 }