View Javadoc
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.site;
21  
22  import java.util.Collections;
23  import java.util.LinkedHashMap;
24  import java.util.Map;
25  
26  /**
27   * Class with result data of ClassAndPropertiesSettersJavadocScraper.
28   */
29  public final class JavadocScraperResultUtil {
30      /**
31       * Map of scraped properties details - name of property, property details object.
32       */
33      private static final Map<String, PropertyDetails> PROPERTIES_DETAILS =
34               new LinkedHashMap<>();
35  
36      /**
37       * The since version of the module.
38       */
39      private static String moduleSinceVersion = "";
40  
41      /**
42       * The description of the module.
43       */
44      private static String moduleDescription = "";
45  
46      /**
47       * The notes of the module.
48       */
49      private static String moduleNotes = "";
50  
51      /**
52       * Private utility constructor.
53       */
54      private JavadocScraperResultUtil() {
55      }
56  
57      /**
58       * Resets the fields.
59       */
60      public static void clearData() {
61          PROPERTIES_DETAILS.clear();
62          moduleSinceVersion = "";
63          moduleDescription = "";
64          moduleNotes = "";
65      }
66  
67      /**
68       * Get the properties details map.
69       *
70       * @return the details map.
71       */
72      public static Map<String, PropertyDetails> getPropertiesDetails() {
73          return Collections.unmodifiableMap(PROPERTIES_DETAILS);
74      }
75  
76      /**
77       * Get the module's since version.
78       *
79       * @return the module's since version.
80       */
81      public static String getModuleSinceVersion() {
82          return moduleSinceVersion;
83      }
84  
85      /**
86       * Sets the module's since version.
87       *
88       * @param sinceVersion module's since version.
89       */
90      /* package */ static void setModuleSinceVersion(String sinceVersion) {
91          moduleSinceVersion = sinceVersion;
92      }
93  
94      /**
95       * Get the module's description.
96       *
97       * @return the module's description.
98       */
99      public static String getModuleDescription() {
100         return moduleDescription;
101     }
102 
103     /**
104      * Sets the module's description.
105      *
106      * @param description module's description.
107      */
108     /* package */ static void setModuleDescription(String description) {
109         moduleDescription = description;
110     }
111 
112     /**
113      * Get the module's notes.
114      *
115      * @return the module's notes.
116      */
117     public static String getModuleNotes() {
118         return moduleNotes;
119     }
120 
121     /**
122      * Sets the module's notes.
123      *
124      * @param notes module's notes.
125      */
126     /* package */ static void setModuleNotes(String notes) {
127         moduleNotes = notes;
128     }
129 
130     /**
131      * Sets additional property details to property map.
132      *
133      * @param propertyName name of property.
134      * @param details property's details.
135      */
136     /* package */ static void putPropertyDetails(String propertyName,
137                                                  PropertyDetails details) {
138         PROPERTIES_DETAILS.put(propertyName, details);
139     }
140 }