View Javadoc
1   /*
2    * SPDX-FileCopyrightText: Copyright (c) 2011-2026 Yegor Bugayenko
3    * SPDX-License-Identifier: MIT
4    */
5   package com.qulice.maven;
6   
7   import com.google.common.base.Predicate;
8   import java.util.Collection;
9   
10  /**
11   * Predicate for excluded dependencies.
12   *
13   * @since 0.1
14   */
15  final class ExcludePredicate implements Predicate<String> {
16  
17      /**
18       * List of excludes.
19       */
20      private final Collection<String> excludes;
21  
22      /**
23       * Constructor.
24       *
25       * @param excludes List of excludes
26       */
27      ExcludePredicate(final Collection<String> excludes) {
28          this.excludes = excludes;
29      }
30  
31      @Override
32      public boolean apply(final String name) {
33          boolean ignore = false;
34          for (final String exclude : this.excludes) {
35              if (name.startsWith(exclude)) {
36                  ignore = true;
37                  break;
38              }
39          }
40          return ignore;
41      }
42  }