Class MetadataGeneratorUtil

java.lang.Object
com.puppycrawl.tools.checkstyle.meta.MetadataGeneratorUtil

public final class MetadataGeneratorUtil extends Object
Class which handles all the metadata generation and writing calls.
  • Constructor Details

  • Method Details

    • generate

      public static void generate(String path, String... moduleFolders) throws IOException, CheckstyleException
      Generate metadata from the module source files available in the input argument path.
      Parameters:
      path - arguments
      moduleFolders - folders to check
      Throws:
      IOException - ioException
      CheckstyleException - checkstyleException
    • getModuleDetails

      private static ModuleDetails getModuleDetails(File file) throws org.apache.maven.doxia.macro.MacroExecutionException
      Generate metadata for the given file.
      Parameters:
      file - file to generate metadata for.
      Returns:
      module details.
      Throws:
      org.apache.maven.doxia.macro.MacroExecutionException - macroExecutionException
    • getModuleType

      private static ModuleType getModuleType(String moduleName)
      Get module type(check/filter/filefilter) based on module name.
      Parameters:
      moduleName - module name.
      Returns:
      module type.
    • getPropertiesDetails

      private static List<ModulePropertyDetails> getPropertiesDetails(Set<String> properties, Map<String,DetailNode> javadocs, String className, Object instance) throws org.apache.maven.doxia.macro.MacroExecutionException
      Get property details for the given property - name, description, type, default value.
      Parameters:
      properties - properties of the module.
      javadocs - javadocs of the module.
      className - the class name of the module.
      instance - the instance of the module.
      Returns:
      property details.
      Throws:
      org.apache.maven.doxia.macro.MacroExecutionException - if an error occurs.
    • getPropertyDefaultValue

      private static String getPropertyDefaultValue(String property, Field field, Object instance, String className) throws org.apache.maven.doxia.macro.MacroExecutionException
      Get default value for the given property.
      Parameters:
      property - property name.
      field - field.
      instance - instance of the module.
      className - class name of the module.
      Returns:
      default value.
      Throws:
      org.apache.maven.doxia.macro.MacroExecutionException - if an error occurs.
    • writeMetadataFile

      private static void writeMetadataFile(ModuleDetails moduleDetails) throws CheckstyleException
      Write metadata file for the given module.
      Parameters:
      moduleDetails - module details.
      Throws:
      CheckstyleException - if an error occurs during writing metadata file.
    • getValidationType

      private static String getValidationType(String propertyName, Field propertyField)
      Get validation type for the given property.
      Parameters:
      propertyName - name of property.
      propertyField - field of property.
      Returns:
      validation type.
    • getPropertyDescription

      private static String getPropertyDescription(String property, DetailNode propertyJavadoc)
      Get property description from property javadoc.
      Parameters:
      property - property name.
      propertyJavadoc - property javadoc.
      Returns:
      property description.
    • getTargetFiles

      private static List<File> getTargetFiles(String path, String... moduleFolders) throws IOException
      Get files that represent modules.
      Parameters:
      moduleFolders - folders to check
      path - rootPath
      Returns:
      files for scrapping javadoc and generation of metadata files
      Throws:
      IOException - ioException