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