Coverage Report - org.apache.maven.model.ModelBase
 
Classes in this File Line Coverage Branch Coverage Complexity
ModelBase
0%
0/76
0%
0/42
1.724
 
 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  
  * 
 15  
  *         
 16  
  *         Base class for the <code>Model</code> and the
 17  
  * <code>Profile</code> objects.
 18  
  *         
 19  
  *       
 20  
  * 
 21  
  * @version $Revision$ $Date$
 22  
  */
 23  0
 public class ModelBase implements java.io.Serializable {
 24  
 
 25  
 
 26  
       //--------------------------/
 27  
      //- Class/Member Variables -/
 28  
     //--------------------------/
 29  
 
 30  
     /**
 31  
      * Distribution information for a project that enables
 32  
      * deployment of the site
 33  
      *             and artifacts to remote web servers and
 34  
      * repositories respectively.
 35  
      */
 36  
     private DistributionManagement distributionManagement;
 37  
 
 38  
     /**
 39  
      * Field modules.
 40  
      */
 41  
     private java.util.List modules;
 42  
 
 43  
     /**
 44  
      * Field repositories.
 45  
      */
 46  
     private java.util.List repositories;
 47  
 
 48  
     /**
 49  
      * Field pluginRepositories.
 50  
      */
 51  
     private java.util.List pluginRepositories;
 52  
 
 53  
     /**
 54  
      * Field dependencies.
 55  
      */
 56  
     private java.util.List dependencies;
 57  
 
 58  
     /**
 59  
      * 
 60  
      *             
 61  
      *             <b>Deprecated</b>. Now ignored by Maven.
 62  
      *             
 63  
      *           
 64  
      */
 65  
     private Object reports;
 66  
 
 67  
     /**
 68  
      * 
 69  
      *             
 70  
      *             This element includes the specification of
 71  
      * report plugins to use
 72  
      *             to generate the reports on the Maven-generated
 73  
      * site.
 74  
      *             These reports will be run when a user executes
 75  
      * <code>mvn site</code>.
 76  
      *             All of the reports will be included in the
 77  
      * navigation bar for browsing.
 78  
      *             
 79  
      *           
 80  
      */
 81  
     private Reporting reporting;
 82  
 
 83  
     /**
 84  
      * Default dependency information for projects that inherit
 85  
      * from this one. The
 86  
      *             dependencies in this section are not immediately
 87  
      * resolved. Instead, when a POM derived
 88  
      *             from this one declares a dependency described by
 89  
      * a matching groupId and artifactId, the
 90  
      *             version and other values from this section are
 91  
      * used for that dependency if they were not
 92  
      *             already specified.
 93  
      */
 94  
     private DependencyManagement dependencyManagement;
 95  
 
 96  
     /**
 97  
      * Field properties.
 98  
      */
 99  
     private java.util.Properties properties;
 100  
 
 101  
 
 102  
       //-----------/
 103  
      //- Methods -/
 104  
     //-----------/
 105  
 
 106  
     /**
 107  
      * Method addDependency.
 108  
      * 
 109  
      * @param dependency
 110  
      */
 111  
     public void addDependency( Dependency dependency )
 112  
     {
 113  0
         if ( !(dependency instanceof Dependency) )
 114  
         {
 115  0
             throw new ClassCastException( "ModelBase.addDependencies(dependency) parameter must be instanceof " + Dependency.class.getName() );
 116  
         }
 117  0
         getDependencies().add( dependency );
 118  0
     } //-- void addDependency( Dependency ) 
 119  
 
 120  
     /**
 121  
      * Method addModule.
 122  
      * 
 123  
      * @param string
 124  
      */
 125  
     public void addModule( String string )
 126  
     {
 127  0
         if ( !(string instanceof String) )
 128  
         {
 129  0
             throw new ClassCastException( "ModelBase.addModules(string) parameter must be instanceof " + String.class.getName() );
 130  
         }
 131  0
         getModules().add( string );
 132  0
     } //-- void addModule( String ) 
 133  
 
 134  
     /**
 135  
      * Method addPluginRepository.
 136  
      * 
 137  
      * @param repository
 138  
      */
 139  
     public void addPluginRepository( Repository repository )
 140  
     {
 141  0
         if ( !(repository instanceof Repository) )
 142  
         {
 143  0
             throw new ClassCastException( "ModelBase.addPluginRepositories(repository) parameter must be instanceof " + Repository.class.getName() );
 144  
         }
 145  0
         getPluginRepositories().add( repository );
 146  0
     } //-- void addPluginRepository( Repository ) 
 147  
 
 148  
     /**
 149  
      * Method addProperty.
 150  
      * 
 151  
      * @param key
 152  
      * @param value
 153  
      */
 154  
     public void addProperty( String key, String value )
 155  
     {
 156  0
         getProperties().put( key, value );
 157  0
     } //-- void addProperty( String, String ) 
 158  
 
 159  
     /**
 160  
      * Method addRepository.
 161  
      * 
 162  
      * @param repository
 163  
      */
 164  
     public void addRepository( Repository repository )
 165  
     {
 166  0
         if ( !(repository instanceof Repository) )
 167  
         {
 168  0
             throw new ClassCastException( "ModelBase.addRepositories(repository) parameter must be instanceof " + Repository.class.getName() );
 169  
         }
 170  0
         getRepositories().add( repository );
 171  0
     } //-- void addRepository( Repository ) 
 172  
 
 173  
     /**
 174  
      * Method getDependencies.
 175  
      * 
 176  
      * @return java.util.List
 177  
      */
 178  
     public java.util.List getDependencies()
 179  
     {
 180  0
         if ( this.dependencies == null )
 181  
         {
 182  0
             this.dependencies = new java.util.ArrayList();
 183  
         }
 184  
     
 185  0
         return this.dependencies;
 186  
     } //-- java.util.List getDependencies() 
 187  
 
 188  
     /**
 189  
      * Get default dependency information for projects that inherit
 190  
      * from this one. The
 191  
      *             dependencies in this section are not immediately
 192  
      * resolved. Instead, when a POM derived
 193  
      *             from this one declares a dependency described by
 194  
      * a matching groupId and artifactId, the
 195  
      *             version and other values from this section are
 196  
      * used for that dependency if they were not
 197  
      *             already specified.
 198  
      * 
 199  
      * @return DependencyManagement
 200  
      */
 201  
     public DependencyManagement getDependencyManagement()
 202  
     {
 203  0
         return this.dependencyManagement;
 204  
     } //-- DependencyManagement getDependencyManagement() 
 205  
 
 206  
     /**
 207  
      * Get distribution information for a project that enables
 208  
      * deployment of the site
 209  
      *             and artifacts to remote web servers and
 210  
      * repositories respectively.
 211  
      * 
 212  
      * @return DistributionManagement
 213  
      */
 214  
     public DistributionManagement getDistributionManagement()
 215  
     {
 216  0
         return this.distributionManagement;
 217  
     } //-- DistributionManagement getDistributionManagement() 
 218  
 
 219  
     /**
 220  
      * Method getModules.
 221  
      * 
 222  
      * @return java.util.List
 223  
      */
 224  
     public java.util.List getModules()
 225  
     {
 226  0
         if ( this.modules == null )
 227  
         {
 228  0
             this.modules = new java.util.ArrayList();
 229  
         }
 230  
     
 231  0
         return this.modules;
 232  
     } //-- java.util.List getModules() 
 233  
 
 234  
     /**
 235  
      * Method getPluginRepositories.
 236  
      * 
 237  
      * @return java.util.List
 238  
      */
 239  
     public java.util.List getPluginRepositories()
 240  
     {
 241  0
         if ( this.pluginRepositories == null )
 242  
         {
 243  0
             this.pluginRepositories = new java.util.ArrayList();
 244  
         }
 245  
     
 246  0
         return this.pluginRepositories;
 247  
     } //-- java.util.List getPluginRepositories() 
 248  
 
 249  
     /**
 250  
      * Method getProperties.
 251  
      * 
 252  
      * @return java.util.Properties
 253  
      */
 254  
     public java.util.Properties getProperties()
 255  
     {
 256  0
         if ( this.properties == null )
 257  
         {
 258  0
             this.properties = new java.util.Properties();
 259  
         }
 260  
     
 261  0
         return this.properties;
 262  
     } //-- java.util.Properties getProperties() 
 263  
 
 264  
     /**
 265  
      * Get 
 266  
      *             
 267  
      *             This element includes the specification of
 268  
      * report plugins to use
 269  
      *             to generate the reports on the Maven-generated
 270  
      * site.
 271  
      *             These reports will be run when a user executes
 272  
      * <code>mvn site</code>.
 273  
      *             All of the reports will be included in the
 274  
      * navigation bar for browsing.
 275  
      *             
 276  
      *           
 277  
      * 
 278  
      * @return Reporting
 279  
      */
 280  
     public Reporting getReporting()
 281  
     {
 282  0
         return this.reporting;
 283  
     } //-- Reporting getReporting() 
 284  
 
 285  
     /**
 286  
      * Get 
 287  
      *             
 288  
      *             <b>Deprecated</b>. Now ignored by Maven.
 289  
      *             
 290  
      *           
 291  
      * 
 292  
      * @return Object
 293  
      */
 294  
     public Object getReports()
 295  
     {
 296  0
         return this.reports;
 297  
     } //-- Object getReports() 
 298  
 
 299  
     /**
 300  
      * Method getRepositories.
 301  
      * 
 302  
      * @return java.util.List
 303  
      */
 304  
     public java.util.List getRepositories()
 305  
     {
 306  0
         if ( this.repositories == null )
 307  
         {
 308  0
             this.repositories = new java.util.ArrayList();
 309  
         }
 310  
     
 311  0
         return this.repositories;
 312  
     } //-- java.util.List getRepositories() 
 313  
 
 314  
     /**
 315  
      * Method removeDependency.
 316  
      * 
 317  
      * @param dependency
 318  
      */
 319  
     public void removeDependency( Dependency dependency )
 320  
     {
 321  0
         if ( !(dependency instanceof Dependency) )
 322  
         {
 323  0
             throw new ClassCastException( "ModelBase.removeDependencies(dependency) parameter must be instanceof " + Dependency.class.getName() );
 324  
         }
 325  0
         getDependencies().remove( dependency );
 326  0
     } //-- void removeDependency( Dependency ) 
 327  
 
 328  
     /**
 329  
      * Method removeModule.
 330  
      * 
 331  
      * @param string
 332  
      */
 333  
     public void removeModule( String string )
 334  
     {
 335  0
         if ( !(string instanceof String) )
 336  
         {
 337  0
             throw new ClassCastException( "ModelBase.removeModules(string) parameter must be instanceof " + String.class.getName() );
 338  
         }
 339  0
         getModules().remove( string );
 340  0
     } //-- void removeModule( String ) 
 341  
 
 342  
     /**
 343  
      * Method removePluginRepository.
 344  
      * 
 345  
      * @param repository
 346  
      */
 347  
     public void removePluginRepository( Repository repository )
 348  
     {
 349  0
         if ( !(repository instanceof Repository) )
 350  
         {
 351  0
             throw new ClassCastException( "ModelBase.removePluginRepositories(repository) parameter must be instanceof " + Repository.class.getName() );
 352  
         }
 353  0
         getPluginRepositories().remove( repository );
 354  0
     } //-- void removePluginRepository( Repository ) 
 355  
 
 356  
     /**
 357  
      * Method removeRepository.
 358  
      * 
 359  
      * @param repository
 360  
      */
 361  
     public void removeRepository( Repository repository )
 362  
     {
 363  0
         if ( !(repository instanceof Repository) )
 364  
         {
 365  0
             throw new ClassCastException( "ModelBase.removeRepositories(repository) parameter must be instanceof " + Repository.class.getName() );
 366  
         }
 367  0
         getRepositories().remove( repository );
 368  0
     } //-- void removeRepository( Repository ) 
 369  
 
 370  
     /**
 371  
      * Set 
 372  
      *             
 373  
      *             This element describes all of the dependencies
 374  
      * associated with a
 375  
      *             project.
 376  
      *             These dependencies are used to construct a
 377  
      * classpath for your
 378  
      *             project during the build process. They are
 379  
      * automatically downloaded from the
 380  
      *             repositories defined in this project.
 381  
      *             See <a
 382  
      * href="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html">the
 383  
      *             dependency mechanism</a> for more information.
 384  
      *             
 385  
      *           
 386  
      * 
 387  
      * @param dependencies
 388  
      */
 389  
     public void setDependencies( java.util.List dependencies )
 390  
     {
 391  0
         this.dependencies = dependencies;
 392  0
     } //-- void setDependencies( java.util.List ) 
 393  
 
 394  
     /**
 395  
      * Set default dependency information for projects that inherit
 396  
      * from this one. The
 397  
      *             dependencies in this section are not immediately
 398  
      * resolved. Instead, when a POM derived
 399  
      *             from this one declares a dependency described by
 400  
      * a matching groupId and artifactId, the
 401  
      *             version and other values from this section are
 402  
      * used for that dependency if they were not
 403  
      *             already specified.
 404  
      * 
 405  
      * @param dependencyManagement
 406  
      */
 407  
     public void setDependencyManagement( DependencyManagement dependencyManagement )
 408  
     {
 409  0
         this.dependencyManagement = dependencyManagement;
 410  0
     } //-- void setDependencyManagement( DependencyManagement ) 
 411  
 
 412  
     /**
 413  
      * Set distribution information for a project that enables
 414  
      * deployment of the site
 415  
      *             and artifacts to remote web servers and
 416  
      * repositories respectively.
 417  
      * 
 418  
      * @param distributionManagement
 419  
      */
 420  
     public void setDistributionManagement( DistributionManagement distributionManagement )
 421  
     {
 422  0
         this.distributionManagement = distributionManagement;
 423  0
     } //-- void setDistributionManagement( DistributionManagement ) 
 424  
 
 425  
     /**
 426  
      * Set the modules (sometimes called subprojects) to build as a
 427  
      * part of this
 428  
      *             project. Each module listed is a relative path
 429  
      * to the directory containing the module.
 430  
      * 
 431  
      * @param modules
 432  
      */
 433  
     public void setModules( java.util.List modules )
 434  
     {
 435  0
         this.modules = modules;
 436  0
     } //-- void setModules( java.util.List ) 
 437  
 
 438  
     /**
 439  
      * Set the lists of the remote repositories for discovering
 440  
      * plugins for builds and
 441  
      *             reports.
 442  
      * 
 443  
      * @param pluginRepositories
 444  
      */
 445  
     public void setPluginRepositories( java.util.List pluginRepositories )
 446  
     {
 447  0
         this.pluginRepositories = pluginRepositories;
 448  0
     } //-- void setPluginRepositories( java.util.List ) 
 449  
 
 450  
     /**
 451  
      * Set 
 452  
      *             
 453  
      *             Properties that can be used throughout the POM
 454  
      * as a substitution, and
 455  
      *             are used as filters in resources if enabled.
 456  
      *             The format is
 457  
      * <code>&lt;name&gt;value&lt;/name&gt;</code>.
 458  
      *             
 459  
      *           
 460  
      * 
 461  
      * @param properties
 462  
      */
 463  
     public void setProperties( java.util.Properties properties )
 464  
     {
 465  0
         this.properties = properties;
 466  0
     } //-- void setProperties( java.util.Properties ) 
 467  
 
 468  
     /**
 469  
      * Set 
 470  
      *             
 471  
      *             This element includes the specification of
 472  
      * report plugins to use
 473  
      *             to generate the reports on the Maven-generated
 474  
      * site.
 475  
      *             These reports will be run when a user executes
 476  
      * <code>mvn site</code>.
 477  
      *             All of the reports will be included in the
 478  
      * navigation bar for browsing.
 479  
      *             
 480  
      *           
 481  
      * 
 482  
      * @param reporting
 483  
      */
 484  
     public void setReporting( Reporting reporting )
 485  
     {
 486  0
         this.reporting = reporting;
 487  0
     } //-- void setReporting( Reporting ) 
 488  
 
 489  
     /**
 490  
      * Set 
 491  
      *             
 492  
      *             <b>Deprecated</b>. Now ignored by Maven.
 493  
      *             
 494  
      *           
 495  
      * 
 496  
      * @param reports
 497  
      */
 498  
     public void setReports( Object reports )
 499  
     {
 500  0
         this.reports = reports;
 501  0
     } //-- void setReports( Object ) 
 502  
 
 503  
     /**
 504  
      * Set the lists of the remote repositories for discovering
 505  
      * dependencies and
 506  
      *             extensions.
 507  
      * 
 508  
      * @param repositories
 509  
      */
 510  
     public void setRepositories( java.util.List repositories )
 511  
     {
 512  0
         this.repositories = repositories;
 513  0
     } //-- void setRepositories( java.util.List ) 
 514  
 
 515  
 
 516  0
     private String modelEncoding = "UTF-8";
 517  
 
 518  
     /**
 519  
      * Set an encoding used for reading/writing the model.
 520  
      *
 521  
      * @param modelEncoding the encoding used when reading/writing the model.
 522  
      */
 523  
     public void setModelEncoding( String modelEncoding )
 524  
     {
 525  0
         this.modelEncoding = modelEncoding;
 526  0
     }
 527  
 
 528  
     /**
 529  
      * @return the current encoding used when reading/writing this model.
 530  
      */
 531  
     public String getModelEncoding()
 532  
     {
 533  0
         return modelEncoding;
 534  
     }
 535  
 }