Coverage Report - org.apache.maven.artifact.resolver.filter.IncludesArtifactFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
IncludesArtifactFilter
0%
0/9
0%
0/6
2
 
 1  
 package org.apache.maven.artifact.resolver.filter;
 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  
 import org.apache.maven.artifact.Artifact;
 23  
 
 24  
 import java.util.Iterator;
 25  
 import java.util.List;
 26  
 
 27  
 /**
 28  
  * Filter to include from a list of artifact patterns.
 29  
  *
 30  
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
 31  
  * @version $Id: IncludesArtifactFilter.java 495147 2007-01-11 07:47:53Z jvanzyl $
 32  
  */
 33  
 public class IncludesArtifactFilter
 34  
     implements ArtifactFilter
 35  
 {
 36  
     private final List patterns;
 37  
 
 38  
     public IncludesArtifactFilter( List patterns )
 39  0
     {
 40  0
         this.patterns = patterns;
 41  0
     }
 42  
 
 43  
     public boolean include( Artifact artifact )
 44  
     {
 45  0
         String id = artifact.getGroupId() + ":" + artifact.getArtifactId();
 46  
 
 47  0
         boolean matched = false;
 48  0
         for ( Iterator i = patterns.iterator(); i.hasNext() & !matched; )
 49  
         {
 50  
             // TODO: what about wildcards? Just specifying groups? versions?
 51  0
             if ( id.equals( i.next() ) )
 52  
             {
 53  0
                 matched = true;
 54  
             }
 55  
         }
 56  0
         return matched;
 57  
     }
 58  
 }