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   * Section for management of default dependency information for use
28   * in a group of
29   *         POMs.
30   * 
31   * @version $Revision$ $Date$
32   */
33  @SuppressWarnings( "all" )
34  public class DependencyManagement
35      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
36  {
37  
38        //--------------------------/
39       //- Class/Member Variables -/
40      //--------------------------/
41  
42      /**
43       * Field dependencies.
44       */
45      private java.util.List<Dependency> dependencies;
46  
47      /**
48       * Field locations.
49       */
50      private java.util.Map<Object, InputLocation> locations;
51  
52      /**
53       * Field location.
54       */
55      private InputLocation location;
56  
57      /**
58       * Field dependenciesLocation.
59       */
60      private InputLocation dependenciesLocation;
61  
62  
63        //-----------/
64       //- Methods -/
65      //-----------/
66  
67      /**
68       * Method addDependency.
69       * 
70       * @param dependency a dependency object.
71       */
72      public void addDependency( Dependency dependency )
73      {
74          getDependencies().add( dependency );
75      } //-- void addDependency( Dependency )
76  
77      /**
78       * Method clone.
79       * 
80       * @return DependencyManagement
81       */
82      public DependencyManagement clone()
83      {
84          try
85          {
86              DependencyManagement copy = (DependencyManagement) super.clone();
87  
88              if ( this.dependencies != null )
89              {
90                  copy.dependencies = new java.util.ArrayList<Dependency>();
91                  for ( Dependency item : this.dependencies )
92                  {
93                      copy.dependencies.add( ( (Dependency) item).clone() );
94                  }
95              }
96  
97              if ( copy.locations != null )
98              {
99                  copy.locations = new java.util.LinkedHashMap( copy.locations );
100             }
101 
102             return copy;
103         }
104         catch ( java.lang.Exception ex )
105         {
106             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
107                 + " does not support clone()" ).initCause( ex );
108         }
109     } //-- DependencyManagement clone()
110 
111     /**
112      * Method getDependencies.
113      * 
114      * @return List
115      */
116     public java.util.List<Dependency> getDependencies()
117     {
118         if ( this.dependencies == null )
119         {
120             this.dependencies = new java.util.ArrayList<Dependency>();
121         }
122 
123         return this.dependencies;
124     } //-- java.util.List<Dependency> getDependencies()
125 
126     /**
127      * 
128      * 
129      * @param key a key object.
130      * @return InputLocation
131      */
132     public InputLocation getLocation( Object key )
133     {
134         if ( key instanceof String )
135         {
136             switch ( ( String ) key )
137             {
138                 case "" :
139                 {
140                     return this.location;
141                 }
142                 case "dependencies" :
143                 {
144                     return dependenciesLocation;
145                 }
146                 default :
147                 {
148                     return getOtherLocation( key );
149                 }
150                 }
151             }
152             else
153             {
154                 return getOtherLocation( key );
155             }
156     } //-- InputLocation getLocation( Object )
157 
158     /**
159      * 
160      * 
161      * @param key a key object.
162      * @param location a location object.
163      */
164     public void setLocation( Object key, InputLocation location )
165     {
166         if ( key instanceof String )
167         {
168             switch ( ( String ) key )
169             {
170                 case "" :
171                 {
172                     this.location = location;
173                     return;
174                 }
175                 case "dependencies" :
176                 {
177                     dependenciesLocation = location;
178                     return;
179                 }
180                 default :
181                 {
182                     setOtherLocation( key, location );
183                     return;
184                 }
185             }
186         }
187         else
188         {
189             setOtherLocation( key, location );
190         }
191     } //-- void setLocation( Object, InputLocation )
192 
193     /**
194      * 
195      * 
196      * @param key a key object.
197      * @param location a location object.
198      */
199     public void setOtherLocation( Object key, InputLocation location )
200     {
201         if ( location != null )
202         {
203             if ( this.locations == null )
204             {
205                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
206             }
207             this.locations.put( key, location );
208         }
209     } //-- void setOtherLocation( Object, InputLocation )
210 
211     /**
212      * 
213      * 
214      * @param key a key object.
215      * @return InputLocation
216      */
217     private InputLocation getOtherLocation( Object key )
218     {
219         return ( locations != null ) ? locations.get( key ) : null;
220     } //-- InputLocation getOtherLocation( Object )
221 
222     /**
223      * Method removeDependency.
224      * 
225      * @param dependency a dependency object.
226      */
227     public void removeDependency( Dependency dependency )
228     {
229         getDependencies().remove( dependency );
230     } //-- void removeDependency( Dependency )
231 
232     /**
233      * Set the dependencies specified here are not used until they
234      * are referenced in a
235      *             POM within the group. This allows the
236      * specification of a "standard" version for a
237      *             particular dependency.
238      * 
239      * @param dependencies a dependencies object.
240      */
241     public void setDependencies( java.util.List<Dependency> dependencies )
242     {
243         this.dependencies = dependencies;
244     } //-- void setDependencies( java.util.List )
245 
246 }