Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AndArtifactFilter |
|
| 2.0;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.ArrayList; | |
25 | import java.util.Iterator; | |
26 | import java.util.List; | |
27 | ||
28 | /** | |
29 | * Apply multiple filters. | |
30 | * | |
31 | * @author <a href="mailto:brett@apache.org">Brett Porter</a> | |
32 | * @version $Id: AndArtifactFilter.java 495147 2007-01-11 07:47:53Z jvanzyl $ | |
33 | */ | |
34 | 0 | public class AndArtifactFilter |
35 | implements ArtifactFilter | |
36 | { | |
37 | 0 | private final List filters = new ArrayList(); |
38 | ||
39 | public boolean include( Artifact artifact ) | |
40 | { | |
41 | 0 | boolean include = true; |
42 | 0 | for ( Iterator i = filters.iterator(); i.hasNext() && include; ) |
43 | { | |
44 | 0 | ArtifactFilter filter = (ArtifactFilter) i.next(); |
45 | 0 | if ( !filter.include( artifact ) ) |
46 | { | |
47 | 0 | include = false; |
48 | } | |
49 | 0 | } |
50 | 0 | return include; |
51 | } | |
52 | ||
53 | public void add( ArtifactFilter artifactFilter ) | |
54 | { | |
55 | 0 | filters.add( artifactFilter ); |
56 | 0 | } |
57 | } |