o simple interface that will be used inside the resolver to allow artifacts to be filtered out from the result list.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163184 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2004-10-06 01:57:59 +00:00
parent 5bfcebab21
commit cf8d34fe69
2 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,26 @@
package org.apache.maven.artifact.resolver.filter;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
public interface ArtifactFilter
{
boolean include( String artifactId );
}

View File

@ -0,0 +1,51 @@
package org.apache.maven.artifact.resolver.filter;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
public class ExclusionSetFilter
implements ArtifactFilter
{
private Set excludes;
public ExclusionSetFilter( String[] excludes )
{
this.excludes = new HashSet( Arrays.asList( excludes ) );
}
public ExclusionSetFilter( Set excludes )
{
this.excludes = excludes;
}
public boolean include( String artifactId )
{
if ( excludes.contains( artifactId ) )
{
return false;
}
return true;
}
}