Coverage Report - org.apache.maven.model.PluginContainer
 
Classes in this File Line Coverage Branch Coverage Complexity
PluginContainer
0%
0/28
0%
0/16
2
 
 1  
 /*
 2  
  * $Id$
 3  
  */
 4  
 
 5  
 package org.apache.maven.model;
 6  
 
 7  
   //---------------------------------/
 8  
  //- Imported classes and packages -/
 9  
 //---------------------------------/
 10  
 
 11  
 import java.util.Date;
 12  
 
 13  
 /**
 14  
  * Contains the plugins informations for the project.
 15  
  * 
 16  
  * @version $Revision$ $Date$
 17  
  */
 18  0
 public class PluginContainer implements java.io.Serializable {
 19  
 
 20  
 
 21  
       //--------------------------/
 22  
      //- Class/Member Variables -/
 23  
     //--------------------------/
 24  
 
 25  
     /**
 26  
      * Field plugins.
 27  
      */
 28  
     private java.util.List plugins;
 29  
 
 30  
 
 31  
       //-----------/
 32  
      //- Methods -/
 33  
     //-----------/
 34  
 
 35  
     /**
 36  
      * Method addPlugin.
 37  
      * 
 38  
      * @param plugin
 39  
      */
 40  
     public void addPlugin( Plugin plugin )
 41  
     {
 42  0
         if ( !(plugin instanceof Plugin) )
 43  
         {
 44  0
             throw new ClassCastException( "PluginContainer.addPlugins(plugin) parameter must be instanceof " + Plugin.class.getName() );
 45  
         }
 46  0
         getPlugins().add( plugin );
 47  0
     } //-- void addPlugin( Plugin ) 
 48  
 
 49  
     /**
 50  
      * Method getPlugins.
 51  
      * 
 52  
      * @return java.util.List
 53  
      */
 54  
     public java.util.List getPlugins()
 55  
     {
 56  0
         if ( this.plugins == null )
 57  
         {
 58  0
             this.plugins = new java.util.ArrayList();
 59  
         }
 60  
     
 61  0
         return this.plugins;
 62  
     } //-- java.util.List getPlugins() 
 63  
 
 64  
     /**
 65  
      * Method removePlugin.
 66  
      * 
 67  
      * @param plugin
 68  
      */
 69  
     public void removePlugin( Plugin plugin )
 70  
     {
 71  0
         if ( !(plugin instanceof Plugin) )
 72  
         {
 73  0
             throw new ClassCastException( "PluginContainer.removePlugins(plugin) parameter must be instanceof " + Plugin.class.getName() );
 74  
         }
 75  0
         getPlugins().remove( plugin );
 76  0
     } //-- void removePlugin( Plugin ) 
 77  
 
 78  
     /**
 79  
      * Set the list of plugins to use.
 80  
      * 
 81  
      * @param plugins
 82  
      */
 83  
     public void setPlugins( java.util.List plugins )
 84  
     {
 85  0
         this.plugins = plugins;
 86  0
     } //-- void setPlugins( java.util.List ) 
 87  
 
 88  
 
 89  
             
 90  
     java.util.Map pluginMap;
 91  
 
 92  
     /**
 93  
      * Reset the <code>pluginsMap</code> field to <code>null</code>
 94  
      */
 95  
     public void flushPluginMap()
 96  
     {
 97  0
         this.pluginMap = null;
 98  0
     }
 99  
 
 100  
     /**
 101  
      * @return a Map of plugins field with <code>Plugins#getKey()</code> as key
 102  
      * @see org.apache.maven.model.Plugin#getKey()
 103  
      */
 104  
     public java.util.Map getPluginsAsMap()
 105  
     {
 106  0
         if ( pluginMap == null )
 107  
         {
 108  0
             pluginMap = new java.util.LinkedHashMap();
 109  0
             if ( plugins != null )
 110  
             {
 111  0
                 for ( java.util.Iterator it = plugins.iterator(); it.hasNext(); )
 112  
                 {
 113  0
                     Plugin plugin = (Plugin) it.next();
 114  0
                     pluginMap.put( plugin.getKey(), plugin );
 115  0
                 }
 116  
             }
 117  
         }
 118  
 
 119  0
         return pluginMap;
 120  
     }
 121  
             
 122  
           
 123  0
     private String modelEncoding = "UTF-8";
 124  
 
 125  
     /**
 126  
      * Set an encoding used for reading/writing the model.
 127  
      *
 128  
      * @param modelEncoding the encoding used when reading/writing the model.
 129  
      */
 130  
     public void setModelEncoding( String modelEncoding )
 131  
     {
 132  0
         this.modelEncoding = modelEncoding;
 133  0
     }
 134  
 
 135  
     /**
 136  
      * @return the current encoding used when reading/writing this model.
 137  
      */
 138  
     public String getModelEncoding()
 139  
     {
 140  0
         return modelEncoding;
 141  
     }
 142  
 }