1 ///////////////////////////////////////////////////////////////////////////////////////////////
2 // checkstyle: Checks Java source code and other text files for adherence to a set of rules.
3 // Copyright (C) 2001-2026 the original author or authors.
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ///////////////////////////////////////////////////////////////////////////////////////////////
19
20 package com.puppycrawl.tools.checkstyle.meta;
21
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.List;
25
26 /** Simple POJO class for module details. */
27 public final class ModuleDetails {
28
29 /** List of properties of the module. */
30 private final List<ModulePropertyDetails> properties = new ArrayList<>();
31
32 /** List of violation message keys of the module. */
33 private final List<String> violationMessageKeys = new ArrayList<>();
34
35 /** Name of the module. */
36 private String name;
37
38 /** Fully qualified name of the module. */
39 private String fullQualifiedName;
40
41 /** Parent module. */
42 private String parent;
43
44 /** Description of the module. */
45 private String description;
46
47 /** Type of the module(check/filter/filefilter). */
48 private ModuleType moduleType;
49
50 /** No-argument constructor. */
51 public ModuleDetails() {
52 // empty constructor
53 }
54
55 /**
56 * All-argument constructor.
57 *
58 * @param name name.
59 * @param fullQualifiedName full qualified name.
60 * @param parent parent.
61 * @param description description.
62 * @param moduleType module type.
63 * @param properties properties.
64 * @param violationMessageKeys violation message keys.
65 */
66 public ModuleDetails(String name, String fullQualifiedName, String parent, String description,
67 ModuleType moduleType, List<ModulePropertyDetails> properties,
68 List<String> violationMessageKeys) {
69 this.name = name;
70 this.fullQualifiedName = fullQualifiedName;
71 this.parent = parent;
72 this.description = description;
73 this.moduleType = moduleType;
74 this.properties.addAll(properties);
75 this.violationMessageKeys.addAll(violationMessageKeys);
76 }
77
78 /**
79 * Get name of module.
80 *
81 * @return name of module
82 */
83 public String getName() {
84 return name;
85 }
86
87 /**
88 * Set name of module.
89 *
90 * @param name module name
91 */
92 public void setName(String name) {
93 this.name = name;
94 }
95
96 /**
97 * Get fully qualified name of module.
98 *
99 * @return fully qualified name of module
100 */
101 public String getFullQualifiedName() {
102 return fullQualifiedName;
103 }
104
105 /**
106 * Set fully qualified name of module.
107 *
108 * @param fullQualifiedName fully qualified name of module
109 */
110 public void setFullQualifiedName(String fullQualifiedName) {
111 this.fullQualifiedName = fullQualifiedName;
112 }
113
114 /**
115 * Get parent of module.
116 *
117 * @return parent of module
118 */
119 public String getParent() {
120 return parent;
121 }
122
123 /**
124 * Set parent of module.
125 *
126 * @param parent parent of module
127 */
128 public void setParent(String parent) {
129 this.parent = parent;
130 }
131
132 /**
133 * Get description of module.
134 *
135 * @return description of module
136 */
137 public String getDescription() {
138 return description;
139 }
140
141 /**
142 * Set description of module.
143 *
144 * @param description description of module
145 */
146 public void setDescription(String description) {
147 this.description = description;
148 }
149
150 /**
151 * Get property list of module.
152 *
153 * @return property list of module
154 */
155 public List<ModulePropertyDetails> getProperties() {
156 return Collections.unmodifiableList(properties);
157 }
158
159 /**
160 * Add a single module property to the module's property list and map both.
161 *
162 * @param property module property
163 */
164 public void addToProperties(ModulePropertyDetails property) {
165 properties.add(property);
166 }
167
168 /**
169 * Add a list of properties to the module's property list and map both.
170 *
171 * @param modulePropertyDetailsList list of module property
172 */
173 public void addToProperties(List<ModulePropertyDetails> modulePropertyDetailsList) {
174 properties.addAll(modulePropertyDetailsList);
175 }
176
177 /**
178 * Get violation message keys of the module.
179 *
180 * @return violation message keys of module
181 */
182 public List<String> getViolationMessageKeys() {
183 return Collections.unmodifiableList(violationMessageKeys);
184 }
185
186 /**
187 * Add a key to the violation message key list of the module.
188 *
189 * @param msg violation message key
190 */
191 public void addToViolationMessages(String msg) {
192 violationMessageKeys.add(msg);
193 }
194
195 /**
196 * Add a list of keys to the violation message key list of the module.
197 *
198 * @param msgList a list of violation message keys
199 */
200 public void addToViolationMessages(List<String> msgList) {
201 violationMessageKeys.addAll(msgList);
202 }
203
204 /**
205 * Get module type.
206 *
207 * @return module type
208 */
209 public ModuleType getModuleType() {
210 return moduleType;
211 }
212
213 /**
214 * Set type of module.
215 *
216 * @param moduleType type of module
217 */
218 public void setModuleType(ModuleType moduleType) {
219 this.moduleType = moduleType;
220 }
221
222 }