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 prerequisites a project can have.
28   * 
29   * @version $Revision$ $Date$
30   */
31  @SuppressWarnings( "all" )
32  public class Prerequisites
33      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
34  {
35  
36        //--------------------------/
37       //- Class/Member Variables -/
38      //--------------------------/
39  
40      /**
41       * 
42       *             For a plugin project (packaging is
43       * <code>maven-plugin</code>), the minimum version of
44       *             Maven required to use the resulting plugin.<br>
45       *             In Maven 2, this was also specifying the minimum
46       * version of Maven required to build a
47       *             project, but this usage is <b>deprecated</b> in
48       * Maven 3 and not checked any more: use
49       *             the <a
50       * href="https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html">Maven
51       * Enforcer Plugin's
52       *             <code>requireMavenVersion</code> rule</a>
53       * instead.
54       *             
55       *           
56       */
57      private String maven = "2.0";
58  
59      /**
60       * Field locations.
61       */
62      private java.util.Map<Object, InputLocation> locations;
63  
64      /**
65       * Field location.
66       */
67      private InputLocation location;
68  
69      /**
70       * Field mavenLocation.
71       */
72      private InputLocation mavenLocation;
73  
74  
75        //-----------/
76       //- Methods -/
77      //-----------/
78  
79      /**
80       * Method clone.
81       * 
82       * @return Prerequisites
83       */
84      public Prerequisites clone()
85      {
86          try
87          {
88              Prerequisites copy = (Prerequisites) super.clone();
89  
90              if ( copy.locations != null )
91              {
92                  copy.locations = new java.util.LinkedHashMap( copy.locations );
93              }
94  
95              return copy;
96          }
97          catch ( java.lang.Exception ex )
98          {
99              throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
100                 + " does not support clone()" ).initCause( ex );
101         }
102     } //-- Prerequisites clone()
103 
104     /**
105      * 
106      * 
107      * @param key a key object.
108      * @return InputLocation
109      */
110     public InputLocation getLocation( Object key )
111     {
112         if ( key instanceof String )
113         {
114             switch ( ( String ) key )
115             {
116                 case "" :
117                 {
118                     return this.location;
119                 }
120                 case "maven" :
121                 {
122                     return mavenLocation;
123                 }
124                 default :
125                 {
126                     return getOtherLocation( key );
127                 }
128                 }
129             }
130             else
131             {
132                 return getOtherLocation( key );
133             }
134     } //-- InputLocation getLocation( Object )
135 
136     /**
137      * Get for a plugin project (packaging is
138      * <code>maven-plugin</code>), the minimum version of
139      *             Maven required to use the resulting plugin.<br>
140      *             In Maven 2, this was also specifying the minimum
141      * version of Maven required to build a
142      *             project, but this usage is <b>deprecated</b> in
143      * Maven 3 and not checked any more: use
144      *             the <a
145      * href="https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html">Maven
146      * Enforcer Plugin's
147      *             <code>requireMavenVersion</code> rule</a>
148      * instead.
149      * 
150      * @return String
151      */
152     public String getMaven()
153     {
154         return this.maven;
155     } //-- String getMaven()
156 
157     /**
158      * 
159      * 
160      * @param key a key object.
161      * @param location a location object.
162      */
163     public void setLocation( Object key, InputLocation location )
164     {
165         if ( key instanceof String )
166         {
167             switch ( ( String ) key )
168             {
169                 case "" :
170                 {
171                     this.location = location;
172                     return;
173                 }
174                 case "maven" :
175                 {
176                     mavenLocation = location;
177                     return;
178                 }
179                 default :
180                 {
181                     setOtherLocation( key, location );
182                     return;
183                 }
184             }
185         }
186         else
187         {
188             setOtherLocation( key, location );
189         }
190     } //-- void setLocation( Object, InputLocation )
191 
192     /**
193      * 
194      * 
195      * @param key a key object.
196      * @param location a location object.
197      */
198     public void setOtherLocation( Object key, InputLocation location )
199     {
200         if ( location != null )
201         {
202             if ( this.locations == null )
203             {
204                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
205             }
206             this.locations.put( key, location );
207         }
208     } //-- void setOtherLocation( Object, InputLocation )
209 
210     /**
211      * 
212      * 
213      * @param key a key object.
214      * @return InputLocation
215      */
216     private InputLocation getOtherLocation( Object key )
217     {
218         return ( locations != null ) ? locations.get( key ) : null;
219     } //-- InputLocation getOtherLocation( Object )
220 
221     /**
222      * Set for a plugin project (packaging is
223      * <code>maven-plugin</code>), the minimum version of
224      *             Maven required to use the resulting plugin.<br>
225      *             In Maven 2, this was also specifying the minimum
226      * version of Maven required to build a
227      *             project, but this usage is <b>deprecated</b> in
228      * Maven 3 and not checked any more: use
229      *             the <a
230      * href="https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html">Maven
231      * Enforcer Plugin's
232      *             <code>requireMavenVersion</code> rule</a>
233      * instead.
234      * 
235      * @param maven a maven object.
236      */
237     public void setMaven( String maven )
238     {
239         this.maven = maven;
240     } //-- void setMaven( String )
241 
242 }