View Javadoc
1   ///////////////////////////////////////////////////////////////////////////////////////////////
2   // checkstyle: Checks Java source code and other text files for adherence to a set of rules.
3   // Copyright (C) 2001-2024 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      /**
51       * Get name of module.
52       *
53       * @return name of module
54       */
55      public String getName() {
56          return name;
57      }
58  
59      /**
60       * Set name of module.
61       *
62       * @param name module name
63       */
64      public void setName(String name) {
65          this.name = name;
66      }
67  
68      /**
69       * Get fully qualified name of module.
70       *
71       * @return fully qualified name of module
72       */
73      public String getFullQualifiedName() {
74          return fullQualifiedName;
75      }
76  
77      /**
78       * Set fully qualified name of module.
79       *
80       * @param fullQualifiedName fully qualified name of module
81       */
82      public void setFullQualifiedName(String fullQualifiedName) {
83          this.fullQualifiedName = fullQualifiedName;
84      }
85  
86      /**
87       * Get parent of module.
88       *
89       * @return parent of module
90       */
91      public String getParent() {
92          return parent;
93      }
94  
95      /**
96       * Set parent of module.
97       *
98       * @param parent parent of module
99       */
100     public void setParent(String parent) {
101         this.parent = parent;
102     }
103 
104     /**
105      * Get description of module.
106      *
107      * @return description of module
108      */
109     public String getDescription() {
110         return description;
111     }
112 
113     /**
114      * Set description of module.
115      *
116      * @param description description of module
117      */
118     public void setDescription(String description) {
119         this.description = description;
120     }
121 
122     /**
123      * Get property list of module.
124      *
125      * @return property list of module
126      */
127     public List<ModulePropertyDetails> getProperties() {
128         return Collections.unmodifiableList(properties);
129     }
130 
131     /**
132      * Add a single module property to the module's property list and map both.
133      *
134      * @param property module property
135      */
136     public void addToProperties(ModulePropertyDetails property) {
137         properties.add(property);
138     }
139 
140     /**
141      * Add a list of properties to the module's property list and map both.
142      *
143      * @param modulePropertyDetailsList list of module property
144      */
145     public void addToProperties(List<ModulePropertyDetails> modulePropertyDetailsList) {
146         properties.addAll(modulePropertyDetailsList);
147     }
148 
149     /**
150      * Get violation message keys of the module.
151      *
152      * @return violation message keys of module
153      */
154     public List<String> getViolationMessageKeys() {
155         return Collections.unmodifiableList(violationMessageKeys);
156     }
157 
158     /**
159      * Add a key to the violation message key list of the module.
160      *
161      * @param msg violation message key
162      */
163     public void addToViolationMessages(String msg) {
164         violationMessageKeys.add(msg);
165     }
166 
167     /**
168      * Add a list of keys to the violation message key list of the module.
169      *
170      * @param msgList a list of violation message keys
171      */
172     public void addToViolationMessages(List<String> msgList) {
173         violationMessageKeys.addAll(msgList);
174     }
175 
176     /**
177      * Get module type.
178      *
179      * @return module type
180      */
181     public ModuleType getModuleType() {
182         return moduleType;
183     }
184 
185     /**
186      * Set type of module.
187      *
188      * @param moduleType type of module
189      */
190     public void setModuleType(ModuleType moduleType) {
191         this.moduleType = moduleType;
192     }
193 }