View Javadoc
1   package com.atlassian.plugin.spring.scanner.core;
2   
3   
4   import org.slf4j.Logger;
5   import org.slf4j.LoggerFactory;
6   
7   import java.net.URL;
8   import java.util.Collections;
9   import java.util.Set;
10  
11  /**
12   * A simple configuration that can be passed to the byte code scanner
13   */
14  public class ByteCodeScannerConfiguration {
15      private final Logger log;
16      private final Set<URL> classPathUrls;
17      private final String includeExclude;
18      private final String outputDirectory;
19      private final boolean verbose;
20  
21      ByteCodeScannerConfiguration(final Logger log, final Set<URL> classPathUrls, final String includeExclude, final String outputDirectory, final boolean verbose) {
22          this.log = log;
23          this.classPathUrls = classPathUrls;
24          this.includeExclude = includeExclude;
25          this.outputDirectory = outputDirectory;
26          this.verbose = verbose;
27      }
28  
29      public Set<URL> getClassPathUrls() {
30          return classPathUrls;
31      }
32  
33      public String getIncludeExclude() {
34          return includeExclude;
35      }
36  
37      public Logger getLog() {
38          return log;
39      }
40  
41      public String getOutputDirectory() {
42          return outputDirectory;
43      }
44  
45      public boolean isVerbose() {
46          return verbose;
47      }
48  
49      public static Builder builder() {
50          return new Builder();
51      }
52  
53      public static class Builder {
54          private Logger log;
55          private Set<URL> classPathUrls = Collections.emptySet();
56          private String includeExclude = "";
57          private String outputDirectory;
58          private boolean verbose;
59  
60          Builder() {
61              log = LoggerFactory.getLogger(AtlassianSpringByteCodeScanner.class.getName());
62          }
63  
64          public Builder setLog(Logger log) {
65              this.log = log;
66              return this;
67          }
68  
69          public Builder setIncludeExclude(final String includeExclude) {
70              this.includeExclude = includeExclude;
71              return this;
72          }
73  
74          public Builder setClassPathUrls(final Set<URL> classPathUrls) {
75              this.classPathUrls = classPathUrls;
76              return this;
77          }
78  
79          public Builder setOutputDirectory(final String outputDirectory) {
80              this.outputDirectory = outputDirectory;
81              return this;
82          }
83  
84          public Builder setVerbose(final boolean verbose) {
85              this.verbose = verbose;
86              return this;
87          }
88  
89          public ByteCodeScannerConfiguration build() {
90              return new ByteCodeScannerConfiguration(log, classPathUrls, includeExclude, outputDirectory, verbose);
91          }
92      }
93  }