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.5.1,
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.
45       *             
46       *           
47       */
48      private String maven = "2.0";
49  
50      /**
51       * Field locations.
52       */
53      private java.util.Map<Object, InputLocation> locations;
54  
55      /**
56       * Field location.
57       */
58      private InputLocation location;
59  
60      /**
61       * Field mavenLocation.
62       */
63      private InputLocation mavenLocation;
64  
65  
66        //-----------/
67       //- Methods -/
68      //-----------/
69  
70      /**
71       * Method clone.
72       * 
73       * @return Prerequisites
74       */
75      public Prerequisites clone()
76      {
77          try
78          {
79              Prerequisites copy = (Prerequisites) super.clone();
80  
81              if ( copy.locations != null )
82              {
83                  copy.locations = new java.util.LinkedHashMap( copy.locations );
84              }
85  
86              return copy;
87          }
88          catch ( java.lang.Exception ex )
89          {
90              throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
91                  + " does not support clone()" ).initCause( ex );
92          }
93      } //-- Prerequisites clone()
94  
95      /**
96       * 
97       * 
98       * @param key a key object.
99       * @return InputLocation
100      */
101     public InputLocation getLocation( Object key )
102     {
103         if ( key instanceof String )
104         {
105             switch ( ( String ) key )
106             {
107                 case "" :
108                 {
109                     return this.location;
110                 }
111                 case "maven" :
112                 {
113                     return mavenLocation;
114                 }
115                 default :
116                 {
117                     return getOtherLocation( key );
118                 }
119                 }
120             }
121             else
122             {
123                 return getOtherLocation( key );
124             }
125     } //-- InputLocation getLocation( Object )
126 
127     /**
128      * Get for a plugin project (packaging is
129      * <code>maven-plugin</code>), the minimum version of
130      *             Maven required to use the resulting plugin.
131      * 
132      * @return String
133      */
134     public String getMaven()
135     {
136         return this.maven;
137     } //-- String getMaven()
138 
139     /**
140      * 
141      * 
142      * @param key a key object.
143      * @param location a location object.
144      */
145     public void setLocation( Object key, InputLocation location )
146     {
147         if ( key instanceof String )
148         {
149             switch ( ( String ) key )
150             {
151                 case "" :
152                 {
153                     this.location = location;
154                     return;
155                 }
156                 case "maven" :
157                 {
158                     mavenLocation = location;
159                     return;
160                 }
161                 default :
162                 {
163                     setOtherLocation( key, location );
164                     return;
165                 }
166             }
167         }
168         else
169         {
170             setOtherLocation( key, location );
171         }
172     } //-- void setLocation( Object, InputLocation )
173 
174     /**
175      * 
176      * 
177      * @param key a key object.
178      * @param location a location object.
179      */
180     public void setOtherLocation( Object key, InputLocation location )
181     {
182         if ( location != null )
183         {
184             if ( this.locations == null )
185             {
186                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
187             }
188             this.locations.put( key, location );
189         }
190     } //-- void setOtherLocation( Object, InputLocation )
191 
192     /**
193      * 
194      * 
195      * @param key a key object.
196      * @return InputLocation
197      */
198     private InputLocation getOtherLocation( Object key )
199     {
200         return ( locations != null ) ? locations.get( key ) : null;
201     } //-- InputLocation getOtherLocation( Object )
202 
203     /**
204      * Set for a plugin project (packaging is
205      * <code>maven-plugin</code>), the minimum version of
206      *             Maven required to use the resulting plugin.
207      * 
208      * @param maven a maven object.
209      */
210     public void setMaven( String maven )
211     {
212         this.maven = maven;
213     } //-- void setMaven( String )
214 
215 }