Bug 8351: enforce check-style rules for restconf
[netconf.git] / restconf / sal-rest-docgen-maven / src / main / java / org / opendaylight / netconf / sal / rest / doc / maven / StaticDocGenerator.java
index a28463209561a3fbb9611f5ab63b249e008a74cd..7a06710f5c1a7f2405bd9c5fed9d304ab7cfa11b 100644 (file)
@@ -28,34 +28,31 @@ import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang2sources.spi.BasicCodeGenerator;
 import org.opendaylight.yangtools.yang2sources.spi.MavenProjectAware;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * This class gathers all yang defined {@link Module}s and generates Swagger compliant documentation.
  */
 public class StaticDocGenerator extends ApiDocGenerator implements BasicCodeGenerator, MavenProjectAware {
-
     private static final String DEFAULT_OUTPUT_BASE_DIR_PATH = "target" + File.separator + "generated-resources"
         + File.separator + "swagger-api-documentation";
 
-    private static final Logger _logger = LoggerFactory.getLogger(ApiDocGenerator.class);
-
     private MavenProject mavenProject;
     private File projectBaseDir;
     private Map<String, String> additionalConfig;
     private File resourceBaseDir;
 
     /**
+     * Generate sources.
      *
-     * @param context
-     * @param outputDir
-     * @param yangModules
-     * @return
-     * @throws IOException
+     * @param context schema context
+     * @param outputDir output directory
+     * @param yangModules modules
+     * @return {@link Collection} of resource files
+     * @throws IOException when file operation fails
      */
     @Override
-    public Collection<File> generateSources(final SchemaContext context, final File outputDir, final Set<Module> yangModules) throws IOException {
+    public Collection<File> generateSources(final SchemaContext context, final File outputDir,
+            final Set<Module> yangModules) throws IOException {
         List<File> result = new ArrayList<>();
 
         // Create Base Directory
@@ -93,7 +90,8 @@ public class StaticDocGenerator extends ApiDocGenerator implements BasicCodeGene
             ApiDeclaration apiDeclaration = super.getApiDeclaration(name, revision, null, context, "");
             String json = mapper.writeValueAsString(apiDeclaration);
             // Manually insert models because org.json.JSONObject cannot be serialized by ObjectMapper
-            json = json.replace("\"models\":{}", "\"models\":" + apiDeclaration.getModels().toString().replace("\\\"", "\""));
+            json = json.replace(
+                "\"models\":{}", "\"models\":" + apiDeclaration.getModels().toString().replace("\\\"", "\""));
             // Escape single quotes and new lines
             json = json.replace("\'", "\\\'").replace("\\n", "\\\\n");
             bufferedWriter.write("\t\tcase \"" + name + "(" + revision + ")\": return \'" + json + "\';\n");