clean up artifact handler a little - fields are all final

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163645 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-03-22 06:51:16 +00:00
parent 7b1f2de259
commit f07d86f311
2 changed files with 25 additions and 22 deletions

View File

@ -32,19 +32,19 @@ public class DefaultArtifact
// These are the only things i need to specify // These are the only things i need to specify
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
private String groupId; private final String groupId;
private String artifactId; private final String artifactId;
private String version; private final String version;
private String type; private final String type;
private String classifier; private final String classifier;
private String scope; private final String scope;
private String extension; private final String extension;
private String path; private String path;
@ -52,7 +52,7 @@ public class DefaultArtifact
* @todo this should be replaced by type handler * @todo this should be replaced by type handler
*/ */
public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type, public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type,
String extension ) String extension )
{ {
this( groupId, artifactId, version, scope, type, null, extension ); this( groupId, artifactId, version, scope, type, null, extension );
} }
@ -62,7 +62,7 @@ public class DefaultArtifact
* only. Classifier is for specifying derived artifacts, like ejb-client. * only. Classifier is for specifying derived artifacts, like ejb-client.
*/ */
public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type, public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type,
String classifier, String extension ) String classifier, String extension )
{ {
if ( type == null ) if ( type == null )
{ {
@ -81,7 +81,14 @@ public class DefaultArtifact
this.classifier = classifier; this.classifier = classifier;
this.extension = extension; if ( extension == null )
{
this.extension = type;
}
else
{
this.extension = extension;
}
} }
public DefaultArtifact( String groupId, String artifactId, String version, String type ) public DefaultArtifact( String groupId, String artifactId, String version, String type )
@ -126,12 +133,7 @@ public class DefaultArtifact
public String getExtension() public String getExtension()
{ {
if ( extension != null ) return extension;
{
return extension;
}
return type;
} }
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------

View File

@ -1,11 +1,7 @@
package org.apache.maven.artifact.handler.manager; package org.apache.maven.artifact.handler.manager;
import org.apache.maven.artifact.handler.ArtifactHandler;
import java.util.Set;
/* /*
* Copyright 2001-2004 The Apache Software Foundation. * Copyright 2001-2005 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,6 +16,10 @@ import java.util.Set;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.maven.artifact.handler.ArtifactHandler;
import java.util.Set;
/** /**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a> * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$ * @version $Id$
@ -28,7 +28,8 @@ public interface ArtifactHandlerManager
{ {
String ROLE = ArtifactHandlerManager.class.getName(); String ROLE = ArtifactHandlerManager.class.getName();
ArtifactHandler getArtifactHandler( String type ) throws ArtifactHandlerNotFoundException; ArtifactHandler getArtifactHandler( String type )
throws ArtifactHandlerNotFoundException;
// String localRepositoryPath( Artifact artifact, ArtifactRepository localRepository ) // String localRepositoryPath( Artifact artifact, ArtifactRepository localRepository )
// throws ArtifactHandlerNotFoundException; // throws ArtifactHandlerNotFoundException;