o change the signature of the filter so that the filter has full access to

the artifact for basing decisions.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163550 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2005-03-14 07:24:23 +00:00
parent 8f754f2bb1
commit 105288fee4
4 changed files with 16 additions and 6 deletions

View File

@ -46,14 +46,18 @@ public class DefaultArtifact
/**
* @todo this should be replaced by type handler
*/
public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type,
String extension )
public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type, String extension )
{
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
this.type = type;
this.scope = scope;
this.extension = extension;
}

View File

@ -212,7 +212,7 @@ public class DefaultArtifactResolver
// It's the first time we have encountered this artifact
// ----------------------------------------------------------------------
if ( filter != null && !filter.include( newArtifact.getArtifactId() ) )
if ( filter != null && !filter.include( newArtifact ) )
{
continue;
}

View File

@ -1,5 +1,7 @@
package org.apache.maven.artifact.resolver.filter;
import org.apache.maven.artifact.Artifact;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
@ -22,5 +24,7 @@ package org.apache.maven.artifact.resolver.filter;
*/
public interface ArtifactFilter
{
boolean include( String artifactId );
//TODO(JVZ): change the signature of this to filter(Artifact) where the meaning of filter is
// to exclude. I did this backward and it's confusing.
boolean include( Artifact artifact );
}

View File

@ -16,6 +16,8 @@ package org.apache.maven.artifact.resolver.filter;
* limitations under the License.
*/
import org.apache.maven.artifact.Artifact;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@ -39,9 +41,9 @@ public class ExclusionSetFilter
this.excludes = excludes;
}
public boolean include( String artifactId )
public boolean include( Artifact artifact )
{
if ( excludes.contains( artifactId ) )
if ( excludes.contains( artifact.getArtifactId() ) )
{
return false;
}