Class ValidationUtils


  • public final class ValidationUtils
    extends java.lang.Object
    Utilities class for validating user's input and generation
    • Constructor Summary

      Constructors 
      Constructor Description
      ValidationUtils()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void checkGenerationReport​(com.devonfw.cobigen.api.to.GenerationReportTo report)
      Checks the generation report in order to find possible errors and warnings
      static boolean isOutputRootPathValid​(java.io.File outputRootPath)
      Checks whether the current output root path is valid.
      static void printNoTriggersMatched​(java.io.File inputFile, boolean isJavaInput, boolean isOpenApiInput)
      Prints an error message to the user informing that no triggers have been matched.
      boolean validateFile​(java.io.File inputFile)
      Validating user input file is correct or not.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ValidationUtils

        public ValidationUtils()
    • Method Detail

      • validateFile

        public boolean validateFile​(java.io.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
      • isOutputRootPathValid

        public static boolean isOutputRootPathValid​(java.io.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 void 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
      • printNoTriggersMatched

        public static void printNoTriggersMatched​(java.io.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