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   * @since 0.1
14   */
15  final class PathPredicate implements Predicate<String> {
16  
17      /**
18       * Path to match.
19       */
20      private final String name;
21  
22      /**
23       * Constructor.
24       * @param name Path to match
25       */
26      PathPredicate(final String name) {
27          this.name = name;
28      }
29  
30      @Override
31      public boolean apply(@Nullable final String input) {
32          return input != null
33              && FilenameUtils.normalize(this.name, true).matches(input);
34      }
35  }