View Javadoc

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   * Section for management of default dependency information for use
15   * in a group of
16   *         POMs.
17   * 
18   * @version $Revision$ $Date$
19   */
20  public class DependencyManagement implements java.io.Serializable {
21  
22  
23        //--------------------------/
24       //- Class/Member Variables -/
25      //--------------------------/
26  
27      /**
28       * Field dependencies.
29       */
30      private java.util.List dependencies;
31  
32  
33        //-----------/
34       //- Methods -/
35      //-----------/
36  
37      /**
38       * Method addDependency.
39       * 
40       * @param dependency
41       */
42      public void addDependency( Dependency dependency )
43      {
44          if ( !(dependency instanceof Dependency) )
45          {
46              throw new ClassCastException( "DependencyManagement.addDependencies(dependency) parameter must be instanceof " + Dependency.class.getName() );
47          }
48          getDependencies().add( dependency );
49      } //-- void addDependency( Dependency ) 
50  
51      /**
52       * Method getDependencies.
53       * 
54       * @return java.util.List
55       */
56      public java.util.List getDependencies()
57      {
58          if ( this.dependencies == null )
59          {
60              this.dependencies = new java.util.ArrayList();
61          }
62      
63          return this.dependencies;
64      } //-- java.util.List getDependencies() 
65  
66      /**
67       * Method removeDependency.
68       * 
69       * @param dependency
70       */
71      public void removeDependency( Dependency dependency )
72      {
73          if ( !(dependency instanceof Dependency) )
74          {
75              throw new ClassCastException( "DependencyManagement.removeDependencies(dependency) parameter must be instanceof " + Dependency.class.getName() );
76          }
77          getDependencies().remove( dependency );
78      } //-- void removeDependency( Dependency ) 
79  
80      /**
81       * Set the dependencies specified here are not used until they
82       * are referenced in a
83       *             POM within the group. This allows the
84       * specification of a "standard" version for a
85       *             particular dependency.
86       * 
87       * @param dependencies
88       */
89      public void setDependencies( java.util.List dependencies )
90      {
91          this.dependencies = dependencies;
92      } //-- void setDependencies( java.util.List ) 
93  
94  
95      private String modelEncoding = "UTF-8";
96  
97      /**
98       * Set an encoding used for reading/writing the model.
99       *
100      * @param modelEncoding the encoding used when reading/writing the model.
101      */
102     public void setModelEncoding( String modelEncoding )
103     {
104         this.modelEncoding = modelEncoding;
105     }
106 
107     /**
108      * @return the current encoding used when reading/writing this model.
109      */
110     public String getModelEncoding()
111     {
112         return modelEncoding;
113     }
114 }