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
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 private final boolean permitDuplicateImports;
21
22 ByteCodeScannerConfiguration(final Logger log, final Set<URL> classPathUrls, final String includeExclude, final String outputDirectory, final boolean verbose, final boolean permitDuplicateImports) {
23 this.log = log;
24 this.classPathUrls = classPathUrls;
25 this.includeExclude = includeExclude;
26 this.outputDirectory = outputDirectory;
27 this.verbose = verbose;
28 this.permitDuplicateImports = permitDuplicateImports;
29 }
30
31 public Set<URL> getClassPathUrls() {
32 return classPathUrls;
33 }
34
35 public String getIncludeExclude() {
36 return includeExclude;
37 }
38
39 public Logger getLog() {
40 return log;
41 }
42
43 public String getOutputDirectory() {
44 return outputDirectory;
45 }
46
47 public boolean isVerbose() {
48 return verbose;
49 }
50
51 public boolean isPermitDuplicateImports() {
52 return permitDuplicateImports;
53 }
54
55 public static Builder builder() {
56 return new Builder();
57 }
58
59 public static class Builder {
60 private Logger log;
61 private Set<URL> classPathUrls = Collections.emptySet();
62 private String includeExclude = "";
63 private String outputDirectory;
64 private boolean verbose;
65 private boolean permitDuplicateImports;
66
67 Builder() {
68 log = LoggerFactory.getLogger(AtlassianSpringByteCodeScanner.class.getName());
69 }
70
71 public Builder setLog(Logger log) {
72 this.log = log;
73 return this;
74 }
75
76 public Builder setIncludeExclude(final String includeExclude) {
77 this.includeExclude = includeExclude;
78 return this;
79 }
80
81 public Builder setClassPathUrls(final Set<URL> classPathUrls) {
82 this.classPathUrls = classPathUrls;
83 return this;
84 }
85
86 public Builder setOutputDirectory(final String outputDirectory) {
87 this.outputDirectory = outputDirectory;
88 return this;
89 }
90
91 public Builder setVerbose(final boolean verbose) {
92 this.verbose = verbose;
93 return this;
94 }
95
96 public Builder setPermitDuplicateImports(final boolean permitDuplicateImports) {
97 this.permitDuplicateImports = permitDuplicateImports;
98 return this;
99 }
100
101 public ByteCodeScannerConfiguration build() {
102 return new ByteCodeScannerConfiguration(log, classPathUrls, includeExclude, outputDirectory, verbose, permitDuplicateImports);
103 }
104 }
105 }