Class QInstanceValidator

java.lang.Object
com.kingsrook.qqq.backend.core.instances.QInstanceValidator

public class QInstanceValidator extends Object
Class that knows how to take a look at the data in a QInstance, and report if it is all valid - e.g., non-null things are set; references line-up (e.g., a table's backend must be a defined backend). Prior to doing validation, the the QInstanceEnricher is ran over the QInstance, e.g., to fill in things that can be defaulted or assumed. TODO let the instance customize or opt-out of Enrichment.
  • Constructor Details

    • QInstanceValidator

      public QInstanceValidator()
  • Method Details

    • validate

      public void validate(QInstance qInstance) throws QInstanceValidationException
      Throws:
      QInstanceValidationException
    • revalidate

      public void revalidate(QInstance qInstance) throws QInstanceValidationException
      Throws:
      QInstanceValidationException
    • addValidatorPlugin

      public static void addValidatorPlugin(QInstanceValidatorPluginInterface<?> plugin)
    • removeAllValidatorPlugins

      public static void removeAllValidatorPlugins()
    • validateQueryFilter

      public void validateQueryFilter(QInstance qInstance, String context, QTableMetaData table, QQueryFilter queryFilter, List<QueryJoin> queryJoins)
    • assertCondition

      public boolean assertCondition(boolean condition, String message)
      For the given input condition, if it's true, then we're all good (and return true). But if it's false, add the provided message to the list of errors (and return false, e.g., in case you need to stop evaluating rules to avoid exceptions).
    • assertNoException

      public boolean assertNoException(UnsafeLambda unsafeLambda, String message)
      For the given lambda, if it doesn't throw an exception, then we're all good (and return true). But if it throws, add the provided message to the list of errors (and return false, e.g., in case you need to stop evaluating rules to avoid exceptions).
    • warn

      public void warn(String message)
    • getErrors

      public List<String> getErrors()
      Getter for errors