All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.maven.model.PluginContainer Maven / Gradle / Ivy

There is a newer version: 4.0.0-beta-5
Show newest version
// =================== DO NOT EDIT THIS FILE ====================
// Generated by Modello 2.1.2,
// any modifications will be overwritten.
// ==============================================================

package org.apache.maven.model;

/**
 * Contains the plugins informations for the project.
 * 
 * @version $Revision$ $Date$
 */
@SuppressWarnings( "all" )
public class PluginContainer
    implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
{

      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field plugins.
     */
    private java.util.List plugins;

    /**
     * Field locations.
     */
    private java.util.Map locations;

    /**
     * Field location.
     */
    private InputLocation location;

    /**
     * Field pluginsLocation.
     */
    private InputLocation pluginsLocation;


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Method addPlugin.
     * 
     * @param plugin a plugin object.
     */
    public void addPlugin( Plugin plugin )
    {
        getPlugins().add( plugin );
    } //-- void addPlugin( Plugin )

    /**
     * Method clone.
     * 
     * @return PluginContainer
     */
    public PluginContainer clone()
    {
        try
        {
            PluginContainer copy = (PluginContainer) super.clone();

            if ( this.plugins != null )
            {
                copy.plugins = new java.util.ArrayList();
                for ( Plugin item : this.plugins )
                {
                    copy.plugins.add( ( (Plugin) item).clone() );
                }
            }

            if ( copy.locations != null )
            {
                copy.locations = new java.util.LinkedHashMap( copy.locations );
            }

            return copy;
        }
        catch ( java.lang.Exception ex )
        {
            throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
                + " does not support clone()" ).initCause( ex );
        }
    } //-- PluginContainer clone()

    /**
     * 
     * 
     * @param key a key object.
     * @return InputLocation
     */
    public InputLocation getLocation( Object key )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    return this.location;
                }
                case "plugins" :
                {
                    return pluginsLocation;
                }
                default :
                {
                    return getOtherLocation( key );
                }
                }
            }
            else
            {
                return getOtherLocation( key );
            }
    } //-- InputLocation getLocation( Object )

    /**
     * 
     * 
     * @param key a key object.
     * @param location a location object.
     */
    public void setLocation( Object key, InputLocation location )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    this.location = location;
                    return;
                }
                case "plugins" :
                {
                    pluginsLocation = location;
                    return;
                }
                default :
                {
                    setOtherLocation( key, location );
                    return;
                }
            }
        }
        else
        {
            setOtherLocation( key, location );
        }
    } //-- void setLocation( Object, InputLocation )

    /**
     * 
     * 
     * @param key a key object.
     * @param location a location object.
     */
    public void setOtherLocation( Object key, InputLocation location )
    {
        if ( location != null )
        {
            if ( this.locations == null )
            {
                this.locations = new java.util.LinkedHashMap();
            }
            this.locations.put( key, location );
        }
    } //-- void setOtherLocation( Object, InputLocation )

    /**
     * 
     * 
     * @param key a key object.
     * @return InputLocation
     */
    private InputLocation getOtherLocation( Object key )
    {
        return ( locations != null ) ? locations.get( key ) : null;
    } //-- InputLocation getOtherLocation( Object )

    /**
     * Method getPlugins.
     * 
     * @return List
     */
    public java.util.List getPlugins()
    {
        if ( this.plugins == null )
        {
            this.plugins = new java.util.ArrayList();
        }

        return this.plugins;
    } //-- java.util.List getPlugins()

    /**
     * Method removePlugin.
     * 
     * @param plugin a plugin object.
     */
    public void removePlugin( Plugin plugin )
    {
        getPlugins().remove( plugin );
    } //-- void removePlugin( Plugin )

    /**
     * Set the list of plugins to use.
     * 
     * @param plugins a plugins object.
     */
    public void setPlugins( java.util.List plugins )
    {
        this.plugins = plugins;
    } //-- void setPlugins( java.util.List )

    
            
    java.util.Map pluginMap;

    /**
     * Reset the pluginsMap field to null
     */
    public synchronized void flushPluginMap()
    {
        this.pluginMap = null;
    }

    /**
     * @return a Map of plugins field with Plugins#getKey() as key
     * @see org.apache.maven.model.Plugin#getKey()
     */
    public synchronized java.util.Map getPluginsAsMap()
    {
        if ( pluginMap == null )
        {
            pluginMap = new java.util.LinkedHashMap();
            if ( plugins != null )
            {
                for ( java.util.Iterator it = plugins.iterator(); it.hasNext(); )
                {
                    Plugin plugin = (Plugin) it.next();
                    pluginMap.put( plugin.getKey(), plugin );
                }
            }
        }

        return pluginMap;
    }
            
          
    
            
     @Override
     public String toString()
     {
         return "PluginContainer {}";
     }
            
          
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy