View Javadoc
1   package org.codehaus.plexus.component.repository;
2   
3   /*
4    * Copyright 2001-2006 Codehaus Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  /**
20   * This represents a project which this component depends upon to function
21   * properly, for example, a required jar file. See Apache Maven for an
22   * example of a dependency in action.
23   *
24   * @author Jason van Zyl
25   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
26   */
27  public class ComponentDependency {
28      private static final String DEAULT_DEPENDENCY_TYPE = "jar";
29  
30      private String groupId;
31  
32      private String artifactId;
33  
34      private String type = DEAULT_DEPENDENCY_TYPE;
35  
36      private String version;
37  
38      /**
39       * Gets a key for an artifact, which is an alias for a specific
40       * project timeline in a group.
41       * @return a key for an artifact
42       */
43      public String getArtifactId() {
44          return artifactId;
45      }
46  
47      /**
48       * Sets the dependency's artifact ID.
49       * @param artifactId the artifact ID
50       */
51      public void setArtifactId(String artifactId) {
52          this.artifactId = artifactId;
53      }
54  
55      /**
56       * Gets a key for a group, which represents a set of artifacts timelines.
57       * @return a key for a group
58       */
59      public String getGroupId() {
60          return groupId;
61      }
62  
63      /**
64       * Sets the dependency's group ID.
65       * @param groupId the group ID
66       */
67      public void setGroupId(String groupId) {
68          this.groupId = groupId;
69      }
70  
71      /**
72       * Gets the type of dependency, for example a "jar".
73       * @return the type of dependency
74       */
75      public String getType() {
76          return type;
77      }
78  
79      /**
80       * Sets the dependency project's type.
81       * @param type the dependency's type
82       */
83      public void setType(String type) {
84          this.type = type;
85      }
86  
87      /**
88       * Returns a specific point in a project's timeline.
89       * i.e. version 1, or 2.1.4
90       * @return a specific point in a project's timeline
91       */
92      public String getVersion() {
93          return version;
94      }
95  
96      /**
97       * Sets the point in a project's development timeline
98       * @param version the project's version
99       */
100     public void setVersion(String version) {
101         this.version = version;
102     }
103 
104     public String toString() {
105         StringBuilder sb = new StringBuilder();
106 
107         sb.append("groupId = ")
108                 .append(groupId)
109                 .append(", artifactId = ")
110                 .append(artifactId)
111                 .append(", version = ")
112                 .append(version)
113                 .append(", type = ")
114                 .append(type);
115 
116         return sb.toString();
117     }
118 }