Class ValidationUtils


  • public final class ValidationUtils
    extends Object
    Utilities class for validating user's input and generation
    • Constructor Detail

      • ValidationUtils

        public ValidationUtils()
    • Method Detail

      • validateFile

        public boolean validateFile​(File inputFile)
        Validating user input file is correct or not. We check if file exists and it can be read
        Parameters:
        inputFile - user input file
        Returns:
        true when file is valid
      • findPom

        public static File findPom​(File source)
        Tries to find a pom.xml file in the passed folder
        Parameters:
        source - folder where we check if a pom.xml file is found
        Returns:
        the pom.xml file if it was found, null otherwise
      • areInputFilesSameType

        public static Boolean areInputFilesSameType​(ArrayList<File> inputFiles)
        Checks whether all the user input files are of the same type
        Parameters:
        inputFiles - user input files
        Returns:
        true when all input files are equal
      • isOutputRootPathValid

        public static Boolean isOutputRootPathValid​(File outputRootPath)
        Checks whether the current output root path is valid. It can be either null because it is an optional parameter or either a folder that exists.
        Parameters:
        outputRootPath - where the user wants to generate the code
        Returns:
        true if it is a valid output root path
      • checkGenerationReport

        public static Boolean checkGenerationReport​(com.devonfw.cobigen.api.to.GenerationReportTo report)
        Checks the generation report in order to find possible errors and warnings
        Parameters:
        report - the generation report returned by the CobiGen.generate method
        Returns:
        true of the generation was successful, false if any error occurred
      • printNoTriggersMatched

        public static void printNoTriggersMatched​(File inputFile,
                                                  Boolean isJavaInput,
                                                  Boolean isOpenApiInput)
        Prints an error message to the user informing that no triggers have been matched. Depending on the type of the input file will print different messages.
        Parameters:
        inputFile - User input file
        isJavaInput - true when input file is Java
        isOpenApiInput - true when input file is OpenAPI