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.qulice.spi.ResourceValidator;
8   import com.qulice.spi.Violation;
9   import java.io.File;
10  import java.util.Collection;
11  import java.util.concurrent.Callable;
12  
13  /**
14   * Callable for validators.
15   *
16   * @since 0.1
17   */
18  final class ValidatorCallable implements Callable<Collection<Violation>> {
19  
20      /**
21       * Validator to use.
22       */
23      private final ResourceValidator validator;
24  
25      /**
26       * Maven environment.
27       */
28      private final MavenEnvironment env;
29  
30      /**
31       * List of files to validate.
32       */
33      private final Collection<File> files;
34  
35      /**
36       * Constructor.
37       *
38       * @param validator Validator to use
39       * @param env Maven environment
40       * @param files List of files to validate
41       */
42      ValidatorCallable(
43          final ResourceValidator validator,
44          final MavenEnvironment env, final Collection<File> files
45      ) {
46          this.validator = validator;
47          this.env = env;
48          this.files = files;
49      }
50  
51      @Override
52      public Collection<Violation> call() {
53          return this.validator.validate(
54              CheckMojo.filter(this.env, this.files, this.validator)
55          );
56      }
57  }