001/////////////////////////////////////////////////////////////////////////////////////////////// 002// checkstyle: Checks Java source code and other text files for adherence to a set of rules. 003// Copyright (C) 2001-2026 the original author or authors. 004// 005// This library is free software; you can redistribute it and/or 006// modify it under the terms of the GNU Lesser General Public 007// License as published by the Free Software Foundation; either 008// version 2.1 of the License, or (at your option) any later version. 009// 010// This library is distributed in the hope that it will be useful, 011// but WITHOUT ANY WARRANTY; without even the implied warranty of 012// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013// Lesser General Public License for more details. 014// 015// You should have received a copy of the GNU Lesser General Public 016// License along with this library; if not, write to the Free Software 017// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 018/////////////////////////////////////////////////////////////////////////////////////////////// 019 020package com.puppycrawl.tools.checkstyle.meta; 021 022import java.util.ArrayList; 023import java.util.Collections; 024import java.util.List; 025 026/** Simple POJO class for module details. */ 027public final class ModuleDetails { 028 029 /** List of properties of the module. */ 030 private final List<ModulePropertyDetails> properties = new ArrayList<>(); 031 032 /** List of violation message keys of the module. */ 033 private final List<String> violationMessageKeys = new ArrayList<>(); 034 035 /** Name of the module. */ 036 private String name; 037 038 /** Fully qualified name of the module. */ 039 private String fullQualifiedName; 040 041 /** Parent module. */ 042 private String parent; 043 044 /** Description of the module. */ 045 private String description; 046 047 /** Type of the module(check/filter/filefilter). */ 048 private ModuleType moduleType; 049 050 /** No-argument constructor. */ 051 public ModuleDetails() { 052 // empty constructor 053 } 054 055 /** 056 * All-argument constructor. 057 * 058 * @param name name. 059 * @param fullQualifiedName full qualified name. 060 * @param parent parent. 061 * @param description description. 062 * @param moduleType module type. 063 * @param properties properties. 064 * @param violationMessageKeys violation message keys. 065 */ 066 public ModuleDetails(String name, String fullQualifiedName, String parent, String description, 067 ModuleType moduleType, List<ModulePropertyDetails> properties, 068 List<String> violationMessageKeys) { 069 this.name = name; 070 this.fullQualifiedName = fullQualifiedName; 071 this.parent = parent; 072 this.description = description; 073 this.moduleType = moduleType; 074 this.properties.addAll(properties); 075 this.violationMessageKeys.addAll(violationMessageKeys); 076 } 077 078 /** 079 * Get name of module. 080 * 081 * @return name of module 082 */ 083 public String getName() { 084 return name; 085 } 086 087 /** 088 * Set name of module. 089 * 090 * @param name module name 091 */ 092 public void setName(String name) { 093 this.name = name; 094 } 095 096 /** 097 * Get fully qualified name of module. 098 * 099 * @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}