001/////////////////////////////////////////////////////////////////////////////////////////////// 002// checkstyle: Checks Java source code and other text files for adherence to a set of rules. 003// Copyright (C) 2001-2025 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 /** List of properties of the module. */ 029 private final List<ModulePropertyDetails> properties = new ArrayList<>(); 030 031 /** List of violation message keys of the module. */ 032 private final List<String> violationMessageKeys = new ArrayList<>(); 033 034 /** Name of the module. */ 035 private String name; 036 037 /** Fully qualified name of the module. */ 038 private String fullQualifiedName; 039 040 /** Parent module. */ 041 private String parent; 042 043 /** Description of the module. */ 044 private String description; 045 046 /** Type of the module(check/filter/filefilter). */ 047 private ModuleType moduleType; 048 049 /** No-argument constructor. */ 050 public ModuleDetails() { 051 // empty constructor 052 } 053 054 /** 055 * All-argument constructor. 056 * 057 * @param name name. 058 * @param fullQualifiedName full qualified name. 059 * @param parent parent. 060 * @param description description. 061 * @param moduleType module type. 062 * @param properties properties. 063 * @param violationMessageKeys violation message keys. 064 */ 065 public ModuleDetails(String name, String fullQualifiedName, String parent, String description, 066 ModuleType moduleType, List<ModulePropertyDetails> properties, 067 List<String> violationMessageKeys) { 068 this.name = name; 069 this.fullQualifiedName = fullQualifiedName; 070 this.parent = parent; 071 this.description = description; 072 this.moduleType = moduleType; 073 this.properties.addAll(properties); 074 this.violationMessageKeys.addAll(violationMessageKeys); 075 } 076 077 /** 078 * Get name of module. 079 * 080 * @return name of module 081 */ 082 public String getName() { 083 return name; 084 } 085 086 /** 087 * Set name of module. 088 * 089 * @param name module name 090 */ 091 public void setName(String name) { 092 this.name = name; 093 } 094 095 /** 096 * Get fully qualified name of module. 097 * 098 * @return fully qualified name of module 099 */ 100 public String getFullQualifiedName() { 101 return fullQualifiedName; 102 } 103 104 /** 105 * Set fully qualified name of module. 106 * 107 * @param fullQualifiedName fully qualified name of module 108 */ 109 public void setFullQualifiedName(String fullQualifiedName) { 110 this.fullQualifiedName = fullQualifiedName; 111 } 112 113 /** 114 * Get parent of module. 115 * 116 * @return parent of module 117 */ 118 public String getParent() { 119 return parent; 120 } 121 122 /** 123 * Set parent of module. 124 * 125 * @param parent parent of module 126 */ 127 public void setParent(String parent) { 128 this.parent = parent; 129 } 130 131 /** 132 * Get description of module. 133 * 134 * @return description of module 135 */ 136 public String getDescription() { 137 return description; 138 } 139 140 /** 141 * Set description of module. 142 * 143 * @param description description of module 144 */ 145 public void setDescription(String description) { 146 this.description = description; 147 } 148 149 /** 150 * Get property list of module. 151 * 152 * @return property list of module 153 */ 154 public List<ModulePropertyDetails> getProperties() { 155 return Collections.unmodifiableList(properties); 156 } 157 158 /** 159 * Add a single module property to the module's property list and map both. 160 * 161 * @param property module property 162 */ 163 public void addToProperties(ModulePropertyDetails property) { 164 properties.add(property); 165 } 166 167 /** 168 * Add a list of properties to the module's property list and map both. 169 * 170 * @param modulePropertyDetailsList list of module property 171 */ 172 public void addToProperties(List<ModulePropertyDetails> modulePropertyDetailsList) { 173 properties.addAll(modulePropertyDetailsList); 174 } 175 176 /** 177 * Get violation message keys of the module. 178 * 179 * @return violation message keys of module 180 */ 181 public List<String> getViolationMessageKeys() { 182 return Collections.unmodifiableList(violationMessageKeys); 183 } 184 185 /** 186 * Add a key to the violation message key list of the module. 187 * 188 * @param msg violation message key 189 */ 190 public void addToViolationMessages(String msg) { 191 violationMessageKeys.add(msg); 192 } 193 194 /** 195 * Add a list of keys to the violation message key list of the module. 196 * 197 * @param msgList a list of violation message keys 198 */ 199 public void addToViolationMessages(List<String> msgList) { 200 violationMessageKeys.addAll(msgList); 201 } 202 203 /** 204 * Get module type. 205 * 206 * @return module type 207 */ 208 public ModuleType getModuleType() { 209 return moduleType; 210 } 211 212 /** 213 * Set type of module. 214 * 215 * @param moduleType type of module 216 */ 217 public void setModuleType(ModuleType moduleType) { 218 this.moduleType = moduleType; 219 } 220}