Class MetadataGeneratorUtil
java.lang.Object
com.puppycrawl.tools.checkstyle.meta.MetadataGeneratorUtil
Class which handles all the metadata generation and writing calls.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidGenerate metadata from the module source files available in the input argument path.private static ModuleDetailsgetModuleDetails(File file) Generate metadata for the given file.private static ModuleTypegetModuleType(String moduleName) Get module type(check/filter/filefilter) based on module name.private static List<ModulePropertyDetails> getPropertiesDetails(Collection<PropertyDetails> propertiesDetails, String className, Object instance) Get property details for the given property - name, description, type, default value.private static StringgetPropertyDefaultValue(PropertyDetails details) Get default value for the given property.getTargetFiles(String path, String... moduleFolders) Get files that represent modules.private static StringgetValidationType(String propertyName, Field propertyField) Get validation type for the given property.private static voidwriteMetadataFile(ModuleDetails moduleDetails) Write metadata file for the given module.
-
Constructor Details
-
MetadataGeneratorUtil
private MetadataGeneratorUtil()Stop instances being created.
-
-
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- argumentsmoduleFolders- folders to check- Throws:
IOException- ioExceptionCheckstyleException- 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
Get module type(check/filter/filefilter) based on module name.- Parameters:
moduleName- module name.- Returns:
- module type.
-
getPropertiesDetails
private static List<ModulePropertyDetails> getPropertiesDetails(Collection<PropertyDetails> propertiesDetails, String className, Object instance) throws org.apache.maven.doxia.macro.MacroExecutionException Get property details for the given property - name, description, type, default value.- Parameters:
propertiesDetails- property details list.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
Get default value for the given property.- Parameters:
details- the property details.- Returns:
- default value.
-
writeMetadataFile
Write metadata file for the given module.- Parameters:
moduleDetails- module details.- Throws:
CheckstyleException- if an error occurs during writing metadata file.
-
getValidationType
Get validation type for the given property.- Parameters:
propertyName- name of property.propertyField- field of property.- Returns:
- validation type.
-
getTargetFiles
Get files that represent modules.- Parameters:
path- rootPathmoduleFolders- folders to check- Returns:
- files for scrapping javadoc and generation of metadata files
- Throws:
IOException- ioException
-