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