1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.nuxeo.build.maven.filter;
18
19 import java.util.List;
20
21 import org.apache.maven.artifact.Artifact;
22 import org.eclipse.aether.graph.DependencyNode;
23
24
25
26
27 public class VersionFilter extends AbstractFilter {
28
29 @Override
30 public String toString() {
31 return super.toString() + " [" + matcher + "]";
32 }
33
34 protected SegmentMatch matcher;
35
36 public VersionFilter(String pattern) {
37 this(SegmentMatch.parse(pattern));
38 }
39
40 public VersionFilter(SegmentMatch matcher) {
41 this.matcher = matcher;
42 }
43
44 @Override
45 public boolean accept(Artifact artifact) {
46 return result(matcher.match(artifact.getVersion()), artifact.toString());
47 }
48
49 @Override
50 public boolean accept(DependencyNode node, List<DependencyNode> parents) {
51 return result(matcher.match(node.getVersion().toString()),
52 node.toString());
53 }
54 }