1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.eclipse.aether.util.filter;
20
21 import java.util.Collection;
22
23 import org.eclipse.aether.version.VersionScheme;
24
25 /**
26 * A simple filter to include artifacts from a list of patterns. The artifact pattern syntax is of the form:
27 *
28 * <pre>
29 * [groupId]:[artifactId]:[extension]:[version]
30 * </pre>
31 * <p>
32 * Where each pattern segment is optional and supports full and partial <code>*</code> wildcards. An empty pattern
33 * segment is treated as an implicit wildcard. Version can be a range in case a {@link VersionScheme} is specified.
34 * </p>
35 * <p>
36 * For example, <code>org.eclipse.*</code> would match all artifacts whose group id started with
37 * <code>org.eclipse.</code> , and <code>:::*-SNAPSHOT</code> would match all snapshot artifacts.
38 * </p>
39 */
40 public final class PatternInclusionsDependencyFilter extends AbstractPatternDependencyFilter {
41
42 /**
43 * Creates a new filter using the specified patterns.
44 *
45 * @param patterns the include patterns, may be {@code null} or empty to include no artifacts
46 */
47 public PatternInclusionsDependencyFilter(final String... patterns) {
48 super(patterns);
49 }
50
51 /**
52 * Creates a new filter using the specified patterns.
53 *
54 * @param versionScheme to be used for parsing versions/version ranges. If {@code null} and pattern specifies a
55 * range no artifact will be included.
56 * @param patterns the include patterns, may be {@code null} or empty to include no artifacts
57 */
58 public PatternInclusionsDependencyFilter(final VersionScheme versionScheme, final String... patterns) {
59 super(versionScheme, patterns);
60 }
61
62 /**
63 * Creates a new filter using the specified patterns.
64 *
65 * @param patterns the include patterns, may be {@code null} or empty to include no artifacts
66 */
67 public PatternInclusionsDependencyFilter(final Collection<String> patterns) {
68 super(patterns);
69 }
70
71 /**
72 * Creates a new filter using the specified patterns and {@link VersionScheme} .
73 *
74 * @param versionScheme to be used for parsing versions/version ranges. If {@code null} and pattern specifies a
75 * range no artifact will be included.
76 * @param patterns the include patterns, may be {@code null} or empty to include no artifacts
77 */
78 public PatternInclusionsDependencyFilter(final VersionScheme versionScheme, final Collection<String> patterns) {
79 super(versionScheme, patterns);
80 }
81 }