1 package org.apache.archiva.admin.repository.admin;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
21 import java.io.Serializable;
24 * @author Olivier Lamy
27 public class LegacyArtifactPath
28 implements Serializable
36 * The artifact reference, as " [groupId] :
37 * [artifactId] : [version] : [classifier] : [type] ".
39 private String artifact;
41 public LegacyArtifactPath()
46 public LegacyArtifactPath( String path, String artifact )
49 this.artifact = artifact;
52 public String getPath()
57 public void setPath( String path )
62 public String getArtifact()
67 public void setArtifact( String artifact )
69 this.artifact = artifact;
72 public boolean match( String path )
74 return path.equals( this.path );
77 public String getGroupId()
79 return artifact.split( ":" )[0];
82 public String getArtifactId()
84 return artifact.split( ":" )[1];
87 public String getVersion()
89 return artifact.split( ":" )[2];
92 public String getClassifier()
94 String classifier = artifact.split( ":" )[3];
95 return classifier.length() > 0 ? classifier : null;
98 public String getType()
100 return artifact.split( ":" )[4];
104 public boolean equals( Object o )
110 if ( o == null || getClass() != o.getClass() )
115 LegacyArtifactPath that = (LegacyArtifactPath) o;
117 if ( path != null ? !path.equals( that.path ) : that.path != null )
126 public int hashCode()
128 return path != null ? 37 + path.hashCode() : 0;
132 public String toString()
134 final StringBuilder sb = new StringBuilder();
135 sb.append( "LegacyArtifactPath" );
136 sb.append( "{path='" ).append( path ).append( '\'' );
137 sb.append( ", artifact='" ).append( artifact ).append( '\'' );
139 return sb.toString();