View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugins.pmd.exec;
20  
21  import java.io.File;
22  import java.io.Serializable;
23  import java.util.ArrayList;
24  import java.util.Collection;
25  import java.util.List;
26  import java.util.Properties;
27  
28  /**
29   * Data object to store all configuration options needed to execute CPD
30   * as a separate process.
31   *
32   * <p>This class is intended to be serialized and read back.
33   *
34   * <p>Some properties might be optional and can be <code>null</code>.
35   */
36  public class CpdRequest implements Serializable {
37      private static final long serialVersionUID = -7585852992660240668L;
38  
39      private String javaExecutable;
40  
41      private int minimumTokens;
42      private String language;
43      private Properties languageProperties;
44      private String sourceEncoding;
45      private List<File> files = new ArrayList<>();
46  
47      private String logLevel;
48  
49      private String excludeFromFailureFile;
50      private String targetDirectory;
51      private String outputEncoding;
52      private String format;
53      private boolean includeXmlInSite;
54      private String reportOutputDirectory;
55      private boolean ignoreAnnotations;
56      private boolean ignoreIdentifiers;
57      private boolean ignoreLiterals;
58  
59      public void setJavaExecutable(String javaExecutable) {
60          this.javaExecutable = javaExecutable;
61      }
62  
63      public void setMinimumTokens(int minimumTokens) {
64          this.minimumTokens = minimumTokens;
65      }
66  
67      public void setLanguage(String language) {
68          this.language = language;
69      }
70  
71      public void setLanguageProperties(Properties languageProperties) {
72          this.languageProperties = languageProperties;
73      }
74  
75      public void setSourceEncoding(String sourceEncoding) {
76          this.sourceEncoding = sourceEncoding;
77      }
78  
79      public void addFiles(Collection<File> files) {
80          this.files.addAll(files);
81      }
82  
83      public void setExcludeFromFailureFile(String excludeFromFailureFile) {
84          this.excludeFromFailureFile = excludeFromFailureFile;
85      }
86  
87      public void setTargetDirectory(String targetDirectory) {
88          this.targetDirectory = targetDirectory;
89      }
90  
91      public void setOutputEncoding(String outputEncoding) {
92          this.outputEncoding = outputEncoding;
93      }
94  
95      public void setFormat(String format) {
96          this.format = format;
97      }
98  
99      public void setIncludeXmlInSite(boolean includeXmlInSite) {
100         this.includeXmlInSite = includeXmlInSite;
101     }
102 
103     public void setReportOutputDirectory(String reportOutputDirectory) {
104         this.reportOutputDirectory = reportOutputDirectory;
105     }
106 
107     public void setLogLevel(String logLevel) {
108         this.logLevel = logLevel;
109     }
110 
111     public String getJavaExecutable() {
112         return javaExecutable;
113     }
114 
115     public int getMinimumTokens() {
116         return minimumTokens;
117     }
118 
119     public String getLanguage() {
120         return language;
121     }
122 
123     public Properties getLanguageProperties() {
124         return languageProperties;
125     }
126 
127     public String getSourceEncoding() {
128         return sourceEncoding;
129     }
130 
131     public List<File> getFiles() {
132         return files;
133     }
134 
135     public String getExcludeFromFailureFile() {
136         return excludeFromFailureFile;
137     }
138 
139     public String getTargetDirectory() {
140         return targetDirectory;
141     }
142 
143     public String getOutputEncoding() {
144         return outputEncoding;
145     }
146 
147     public String getFormat() {
148         return format;
149     }
150 
151     public boolean isIncludeXmlInSite() {
152         return includeXmlInSite;
153     }
154 
155     public String getReportOutputDirectory() {
156         return reportOutputDirectory;
157     }
158 
159     public String getLogLevel() {
160         return logLevel;
161     }
162 
163     public boolean isIgnoreAnnotations() {
164         return ignoreAnnotations;
165     }
166 
167     public void setIgnoreAnnotations(boolean ignoreAnnotations) {
168         this.ignoreAnnotations = ignoreAnnotations;
169     }
170 
171     public void setIgnoreIdentifiers(boolean ignoreIdentifiers) {
172         this.ignoreIdentifiers = ignoreIdentifiers;
173     }
174 
175     public boolean isIgnoreIdentifiers() {
176         return ignoreIdentifiers;
177     }
178 
179     public void setIgnoreLiterals(boolean ignoreLiterals) {
180         this.ignoreLiterals = ignoreLiterals;
181     }
182 
183     public boolean isIgnoreLiterals() {
184         return ignoreLiterals;
185     }
186 }