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    * Contains the plugins informations for the project.
10   * 
11   * @version $Revision$ $Date$
12   */
13  @SuppressWarnings( "all" )
14  public class PluginContainer
15      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
16  {
17  
18        //--------------------------/
19       //- Class/Member Variables -/
20      //--------------------------/
21  
22      /**
23       * Field plugins.
24       */
25      private java.util.List<Plugin> plugins;
26  
27      /**
28       * Field locations.
29       */
30      private java.util.Map<Object, InputLocation> locations;
31  
32      /**
33       * Field location.
34       */
35      private InputLocation location;
36  
37      /**
38       * Field pluginsLocation.
39       */
40      private InputLocation pluginsLocation;
41  
42  
43        //-----------/
44       //- Methods -/
45      //-----------/
46  
47      /**
48       * Method addPlugin.
49       * 
50       * @param plugin
51       */
52      public void addPlugin( Plugin plugin )
53      {
54          getPlugins().add( plugin );
55      } //-- void addPlugin( Plugin )
56  
57      /**
58       * Method clone.
59       * 
60       * @return PluginContainer
61       */
62      public PluginContainer clone()
63      {
64          try
65          {
66              PluginContainer copy = (PluginContainer) super.clone();
67  
68              if ( this.plugins != null )
69              {
70                  copy.plugins = new java.util.ArrayList<Plugin>();
71                  for ( Plugin item : this.plugins )
72                  {
73                      copy.plugins.add( ( (Plugin) item).clone() );
74                  }
75              }
76  
77              if ( copy.locations != null )
78              {
79                  copy.locations = new java.util.LinkedHashMap( copy.locations );
80              }
81  
82              return copy;
83          }
84          catch ( java.lang.Exception ex )
85          {
86              throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
87                  + " does not support clone()" ).initCause( ex );
88          }
89      } //-- PluginContainer clone()
90  
91      /**
92       * 
93       * 
94       * @param key
95       * @return InputLocation
96       */
97      public InputLocation getLocation( Object key )
98      {
99          if ( key instanceof String )
100         {
101             switch ( ( String ) key )
102             {
103                 case "" :
104                 {
105                     return this.location;
106                 }
107                 case "plugins" :
108                 {
109                     return pluginsLocation;
110                 }
111                 default :
112                 {
113                     return getOtherLocation( key );
114                 }
115                 }
116             }
117             else
118             {
119                 return getOtherLocation( key );
120             }
121     } //-- InputLocation getLocation( Object )
122 
123     /**
124      * 
125      * 
126      * @param key
127      * @param location
128      */
129     public void setLocation( Object key, InputLocation location )
130     {
131         if ( key instanceof String )
132         {
133             switch ( ( String ) key )
134             {
135                 case "" :
136                 {
137                     this.location = location;
138                     return;
139                 }
140                 case "plugins" :
141                 {
142                     pluginsLocation = location;
143                     return;
144                 }
145                 default :
146                 {
147                     setOtherLocation( key, location );
148                     return;
149                 }
150                 }
151             }
152             else
153             {
154                 setOtherLocation( key, location );
155             }
156     } //-- void setLocation( Object, InputLocation )
157 
158     /**
159      * 
160      * 
161      * @param key
162      * @param location
163      */
164     public void setOtherLocation( Object key, InputLocation location )
165     {
166         if ( location != null )
167         {
168             if ( this.locations == null )
169             {
170                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
171             }
172             this.locations.put( key, location );
173         }
174     } //-- void setOtherLocation( Object, InputLocation )
175 
176     /**
177      * 
178      * 
179      * @param key
180      * @return InputLocation
181      */
182     private InputLocation getOtherLocation( Object key )
183     {
184         return ( locations != null ) ? locations.get( key ) : null;
185     } //-- InputLocation getOtherLocation( Object )
186 
187     /**
188      * Method getPlugins.
189      * 
190      * @return List
191      */
192     public java.util.List<Plugin> getPlugins()
193     {
194         if ( this.plugins == null )
195         {
196             this.plugins = new java.util.ArrayList<Plugin>();
197         }
198 
199         return this.plugins;
200     } //-- java.util.List<Plugin> getPlugins()
201 
202     /**
203      * Method removePlugin.
204      * 
205      * @param plugin
206      */
207     public void removePlugin( Plugin plugin )
208     {
209         getPlugins().remove( plugin );
210     } //-- void removePlugin( Plugin )
211 
212     /**
213      * Set the list of plugins to use.
214      * 
215      * @param plugins
216      */
217     public void setPlugins( java.util.List<Plugin> plugins )
218     {
219         this.plugins = plugins;
220     } //-- void setPlugins( java.util.List )
221 
222     
223             
224     java.util.Map<String, Plugin> pluginMap;
225 
226     /**
227      * Reset the <code>pluginsMap</code> field to <code>null</code>
228      */
229     public synchronized void flushPluginMap()
230     {
231         this.pluginMap = null;
232     }
233 
234     /**
235      * @return a Map of plugins field with <code>Plugins#getKey()</code> as key
236      * @see org.apache.maven.model.Plugin#getKey()
237      */
238     public synchronized java.util.Map<String, Plugin> getPluginsAsMap()
239     {
240         if ( pluginMap == null )
241         {
242             pluginMap = new java.util.LinkedHashMap<String, Plugin>();
243             if ( plugins != null )
244             {
245                 for ( java.util.Iterator<Plugin> it = plugins.iterator(); it.hasNext(); )
246                 {
247                     Plugin plugin = (Plugin) it.next();
248                     pluginMap.put( plugin.getKey(), plugin );
249                 }
250             }
251         }
252 
253         return pluginMap;
254     }
255             
256           
257     
258             
259      @Override
260      public String toString()
261      {
262          return "PluginContainer {}";
263      }
264             
265           
266 }