KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > jayasoft > ivy > filter > ArtifactTypeFilter


1 /*
2  * This file is subject to the licence found in LICENCE.TXT in the root directory of the project.
3  * Copyright Jayasoft 2005 - All rights reserved
4  *
5  * #SNAPSHOT#
6  */

7 package fr.jayasoft.ivy.filter;
8
9 import java.util.ArrayList JavaDoc;
10 import java.util.Collection JavaDoc;
11
12 import fr.jayasoft.ivy.Artifact;
13
14 public class ArtifactTypeFilter implements Filter {
15     private Collection JavaDoc _acceptedTypes;
16     
17     public ArtifactTypeFilter(Collection JavaDoc acceptedTypes) {
18         _acceptedTypes = new ArrayList JavaDoc(acceptedTypes);
19     }
20     
21     public boolean accept(Object JavaDoc o) {
22         if (! (o instanceof Artifact)) {
23             return false;
24         }
25         Artifact art = (Artifact)o;
26         return _acceptedTypes.contains(art.getType());
27     }
28 }
29
Popular Tags