001    /*
002     =================== DO NOT EDIT THIS FILE ====================
003     Generated by Modello 1.4.1 on 2013-02-24 03:31:02,
004     any modifications will be overwritten.
005     ==============================================================
006     */
007    
008    package org.apache.maven.model;
009    
010    /**
011     * Contains the plugins informations for the project.
012     * 
013     * @version $Revision$ $Date$
014     */
015    @SuppressWarnings( "all" )
016    public class PluginContainer
017        implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
018    {
019    
020          //--------------------------/
021         //- Class/Member Variables -/
022        //--------------------------/
023    
024        /**
025         * Field plugins.
026         */
027        private java.util.List<Plugin> plugins;
028    
029        /**
030         * Field locations.
031         */
032        private java.util.Map<Object, InputLocation> locations;
033    
034    
035          //-----------/
036         //- Methods -/
037        //-----------/
038    
039        /**
040         * Method addPlugin.
041         * 
042         * @param plugin
043         */
044        public void addPlugin( Plugin plugin )
045        {
046            getPlugins().add( plugin );
047        } //-- void addPlugin( Plugin )
048    
049        /**
050         * Method clone.
051         * 
052         * @return PluginContainer
053         */
054        public PluginContainer clone()
055        {
056            try
057            {
058                PluginContainer copy = (PluginContainer) super.clone();
059    
060                if ( this.plugins != null )
061                {
062                    copy.plugins = new java.util.ArrayList<Plugin>();
063                    for ( Plugin item : this.plugins )
064                    {
065                        copy.plugins.add( ( (Plugin) item).clone() );
066                    }
067                }
068    
069                if ( copy.locations != null )
070                {
071                    copy.locations = new java.util.LinkedHashMap( copy.locations );
072                }
073    
074                return copy;
075            }
076            catch ( java.lang.Exception ex )
077            {
078                throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
079                    + " does not support clone()" ).initCause( ex );
080            }
081        } //-- PluginContainer clone()
082    
083        /**
084         * 
085         * 
086         * @param key
087         * @return InputLocation
088         */
089        public InputLocation getLocation( Object key )
090        {
091            return ( locations != null ) ? locations.get( key ) : null;
092        } //-- InputLocation getLocation( Object )
093    
094        /**
095         * Method getPlugins.
096         * 
097         * @return List
098         */
099        public java.util.List<Plugin> getPlugins()
100        {
101            if ( this.plugins == null )
102            {
103                this.plugins = new java.util.ArrayList<Plugin>();
104            }
105    
106            return this.plugins;
107        } //-- java.util.List<Plugin> getPlugins()
108    
109        /**
110         * Method removePlugin.
111         * 
112         * @param plugin
113         */
114        public void removePlugin( Plugin plugin )
115        {
116            getPlugins().remove( plugin );
117        } //-- void removePlugin( Plugin )
118    
119        /**
120         * 
121         * 
122         * @param key
123         * @param location
124         */
125        public void setLocation( Object key, InputLocation location )
126        {
127            if ( location != null )
128            {
129                if ( this.locations == null )
130                {
131                    this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
132                }
133                this.locations.put( key, location );
134            }
135        } //-- void setLocation( Object, InputLocation )
136    
137        /**
138         * Set the list of plugins to use.
139         * 
140         * @param plugins
141         */
142        public void setPlugins( java.util.List<Plugin> plugins )
143        {
144            this.plugins = plugins;
145        } //-- void setPlugins( java.util.List )
146    
147        
148                
149        java.util.Map<String, Plugin> pluginMap;
150    
151        /**
152         * Reset the <code>pluginsMap</code> field to <code>null</code>
153         */
154        public synchronized void flushPluginMap()
155        {
156            this.pluginMap = null;
157        }
158    
159        /**
160         * @return a Map of plugins field with <code>Plugins#getKey()</code> as key
161         * @see org.apache.maven.model.Plugin#getKey()
162         */
163        public synchronized java.util.Map<String, Plugin> getPluginsAsMap()
164        {
165            if ( pluginMap == null )
166            {
167                pluginMap = new java.util.LinkedHashMap<String, Plugin>();
168                if ( plugins != null )
169                {
170                    for ( java.util.Iterator<Plugin> it = plugins.iterator(); it.hasNext(); )
171                    {
172                        Plugin plugin = (Plugin) it.next();
173                        pluginMap.put( plugin.getKey(), plugin );
174                    }
175                }
176            }
177    
178            return pluginMap;
179        }
180                
181              
182    }