001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.eclipse.aether.util.filter; 020 021import java.util.Collection; 022 023import org.eclipse.aether.version.VersionScheme; 024 025/** 026 * A simple filter to include artifacts from a list of patterns. The artifact pattern syntax is of the form: 027 * 028 * <pre> 029 * [groupId]:[artifactId]:[extension]:[version] 030 * </pre> 031 * <p> 032 * Where each pattern segment is optional and supports full and partial <code>*</code> wildcards. An empty pattern 033 * segment is treated as an implicit wildcard. Version can be a range in case a {@link VersionScheme} is specified. 034 * </p> 035 * <p> 036 * For example, <code>org.eclipse.*</code> would match all artifacts whose group id started with 037 * <code>org.eclipse.</code> , and <code>:::*-SNAPSHOT</code> would match all snapshot artifacts. 038 * </p> 039 */ 040public final class PatternInclusionsDependencyFilter extends AbstractPatternDependencyFilter { 041 042 /** 043 * Creates a new filter using the specified patterns. 044 * 045 * @param patterns The include patterns, may be {@code null} or empty to include no artifacts. 046 */ 047 public PatternInclusionsDependencyFilter(final String... patterns) { 048 super(patterns); 049 } 050 051 /** 052 * Creates a new filter using the specified patterns. 053 * 054 * @param versionScheme To be used for parsing versions/version ranges. If {@code null} and pattern specifies a 055 * range no artifact will be included. 056 * @param patterns The include patterns, may be {@code null} or empty to include no artifacts. 057 */ 058 public PatternInclusionsDependencyFilter(final VersionScheme versionScheme, final String... patterns) { 059 super(versionScheme, patterns); 060 } 061 062 /** 063 * Creates a new filter using the specified patterns. 064 * 065 * @param patterns The include patterns, may be {@code null} or empty to include no artifacts. 066 */ 067 public PatternInclusionsDependencyFilter(final Collection<String> patterns) { 068 super(patterns); 069 } 070 071 /** 072 * Creates a new filter using the specified patterns and {@link VersionScheme} . 073 * 074 * @param versionScheme To be used for parsing versions/version ranges. If {@code null} and pattern specifies a 075 * range no artifact will be included. 076 * @param patterns The include patterns, may be {@code null} or empty to include no artifacts. 077 */ 078 public PatternInclusionsDependencyFilter(final VersionScheme versionScheme, final Collection<String> patterns) { 079 super(versionScheme, patterns); 080 } 081}