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 javax.annotation.Nullable;
9   import org.apache.commons.io.FilenameUtils;
10  
11  /**
12   * Checks if two paths are equal.
13   *
14   * @since 0.1
15   */
16  final class PathPredicate implements Predicate<String> {
17  
18      /**
19       * Path to match.
20       */
21      private final String name;
22  
23      /**
24       * Constructor.
25       *
26       * @param name Path to match
27       */
28      PathPredicate(final String name) {
29          this.name = name;
30      }
31  
32      @Override
33      public boolean apply(@Nullable final String input) {
34          return input != null
35              && FilenameUtils.normalize(this.name, true).matches(input);
36      }
37  }