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