This project has retired. For details please refer to its Attic page.
LegacyArtifactPath xref
View Javadoc
1   package org.apache.archiva.configuration;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * Class LegacyArtifactPath.
24   * 
25   * @version $Revision$ $Date$
26   */
27  @SuppressWarnings( "all" )
28  public class LegacyArtifactPath
29      implements java.io.Serializable
30  {
31  
32        //--------------------------/
33       //- Class/Member Variables -/
34      //--------------------------/
35  
36      /**
37       * 
38       *             The legacy path.
39       *           
40       */
41      private String path;
42  
43      /**
44       * 
45       *             The artifact reference, as " [groupId] :
46       * [artifactId] : [version] : [classifier] : [type] ".
47       *           
48       */
49      private String artifact;
50  
51  
52        //-----------/
53       //- Methods -/
54      //-----------/
55  
56      /**
57       * Get the artifact reference, as " [groupId] : [artifactId] :
58       * [version] : [classifier] : [type] ".
59       * 
60       * @return String
61       */
62      public String getArtifact()
63      {
64          return this.artifact;
65      } //-- String getArtifact()
66  
67      /**
68       * Get the legacy path.
69       * 
70       * @return String
71       */
72      public String getPath()
73      {
74          return this.path;
75      } //-- String getPath()
76  
77      /**
78       * Set the artifact reference, as " [groupId] : [artifactId] :
79       * [version] : [classifier] : [type] ".
80       * 
81       * @param artifact
82       */
83      public void setArtifact( String artifact )
84      {
85          this.artifact = artifact;
86      } //-- void setArtifact( String )
87  
88      /**
89       * Set the legacy path.
90       * 
91       * @param path
92       */
93      public void setPath( String path )
94      {
95          this.path = path;
96      } //-- void setPath( String )
97  
98      
99      public boolean match( String path )
100     {
101         return path.equals( this.path );
102     }
103 
104     public String getGroupId()
105     {
106         return artifact.split( ":" )[0];
107     }
108 
109     public String getArtifactId()
110     {
111         return artifact.split( ":" )[1];
112     }
113         
114     public String getVersion()
115     {
116         return artifact.split( ":" )[2];
117     }
118     
119     public String getClassifier()
120     {
121         String classifier = artifact.split( ":" )[3];
122         return classifier.length() > 0 ? classifier : null;
123     }
124     
125     public String getType()
126     {
127         return artifact.split( ":" )[4];
128     }
129 
130     @Override
131     public boolean equals( Object o )
132     {
133         if ( this == o )
134         {
135             return true;
136         }
137         if ( o == null || getClass() != o.getClass() )
138         {
139             return false;
140         }
141 
142         LegacyArtifactPath./org/apache/archiva/configuration/LegacyArtifactPath.html#LegacyArtifactPath">LegacyArtifactPath that = (LegacyArtifactPath) o;
143 
144         if ( path != null ? !path.equals( that.path ) : that.path != null )
145         {
146             return false;
147         }
148 
149         return true;
150     }
151 
152     @Override
153     public int hashCode()
154     {
155         return path != null ? 37 + path.hashCode() : 0;
156     }
157        
158 }