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.Map;
27  import java.util.Properties;
28  
29  /**
30   * Data object to store all configuration options needed to execute CPD
31   * as a separate process.
32   *
33   * <p>This class is intended to be serialized and read back.
34   *
35   * <p>Some properties might be optional and can be <code>null</code>.
36   */
37  public class CpdRequest implements Serializable {
38      private static final long serialVersionUID = -7585852992660240668L;
39  
40      private Map<String, String> jdkToolchain;
41  
42      private int minimumTokens;
43      private String language;
44      private Properties languageProperties;
45      private String sourceEncoding;
46      private List<File> files = new ArrayList<>();
47  
48      private String excludeFromFailureFile;
49      private String targetDirectory;
50      private String outputEncoding;
51      private String format;
52      private boolean includeXmlInReports;
53      private String reportOutputDirectory;
54      private boolean ignoreAnnotations;
55      private boolean ignoreIdentifiers;
56      private boolean ignoreLiterals;
57  
58      public void setJdkToolchain(Map<String, String> jdkToolchain) {
59          this.jdkToolchain = jdkToolchain;
60      }
61  
62      public void setMinimumTokens(int minimumTokens) {
63          this.minimumTokens = minimumTokens;
64      }
65  
66      public void setLanguage(String language) {
67          this.language = language;
68      }
69  
70      public void setLanguageProperties(Properties languageProperties) {
71          this.languageProperties = languageProperties;
72      }
73  
74      public void setSourceEncoding(String sourceEncoding) {
75          this.sourceEncoding = sourceEncoding;
76      }
77  
78      public void addFiles(Collection<File> files) {
79          this.files.addAll(files);
80      }
81  
82      public void setExcludeFromFailureFile(String excludeFromFailureFile) {
83          this.excludeFromFailureFile = excludeFromFailureFile;
84      }
85  
86      public void setTargetDirectory(String targetDirectory) {
87          this.targetDirectory = targetDirectory;
88      }
89  
90      public void setOutputEncoding(String outputEncoding) {
91          this.outputEncoding = outputEncoding;
92      }
93  
94      public void setFormat(String format) {
95          this.format = format;
96      }
97  
98      public void setIncludeXmlInReports(boolean includeXmlInReports) {
99          this.includeXmlInReports = includeXmlInReports;
100     }
101 
102     public void setReportOutputDirectory(String reportOutputDirectory) {
103         this.reportOutputDirectory = reportOutputDirectory;
104     }
105 
106     public Map<String, String> getJdkToolchain() {
107         return jdkToolchain;
108     }
109 
110     public int getMinimumTokens() {
111         return minimumTokens;
112     }
113 
114     public String getLanguage() {
115         return language;
116     }
117 
118     public Properties getLanguageProperties() {
119         return languageProperties;
120     }
121 
122     public String getSourceEncoding() {
123         return sourceEncoding;
124     }
125 
126     public List<File> getFiles() {
127         return files;
128     }
129 
130     public String getExcludeFromFailureFile() {
131         return excludeFromFailureFile;
132     }
133 
134     public String getTargetDirectory() {
135         return targetDirectory;
136     }
137 
138     public String getOutputEncoding() {
139         return outputEncoding;
140     }
141 
142     public String getFormat() {
143         return format;
144     }
145 
146     public boolean isIncludeXmlInReports() {
147         return includeXmlInReports;
148     }
149 
150     public String getReportOutputDirectory() {
151         return reportOutputDirectory;
152     }
153 
154     public boolean isIgnoreAnnotations() {
155         return ignoreAnnotations;
156     }
157 
158     public void setIgnoreAnnotations(boolean ignoreAnnotations) {
159         this.ignoreAnnotations = ignoreAnnotations;
160     }
161 
162     public void setIgnoreIdentifiers(boolean ignoreIdentifiers) {
163         this.ignoreIdentifiers = ignoreIdentifiers;
164     }
165 
166     public boolean isIgnoreIdentifiers() {
167         return ignoreIdentifiers;
168     }
169 
170     public void setIgnoreLiterals(boolean ignoreLiterals) {
171         this.ignoreLiterals = ignoreLiterals;
172     }
173 
174     public boolean isIgnoreLiterals() {
175         return ignoreLiterals;
176     }
177 }