Class QInstanceValidator
java.lang.Object
com.kingsrook.qqq.backend.core.instances.QInstanceValidator
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
boolean
assertCondition
(boolean condition, String message) For the given input condition, if it's true, then we're all good (and return true).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).Getter for errorsstatic ListingHash
<Class<?>, QInstanceValidatorPluginInterface<?>> Getter for validatorPluginsstatic void
void
revalidate
(QInstance qInstance) void
void
validateField
(QInstance qInstance, String prefix, Optional<QTableMetaData> table, QFieldMetaData field) run validation on a field - optionally within the context of a table.void
validateFieldSupplementalMetaData
(QFieldMetaData field, QInstance qInstance) void
validateQueryFilter
(QInstance qInstance, String context, QTableMetaData table, QQueryFilter queryFilter, List<QueryJoin> queryJoins) void
validateSimpleCodeReference
(String prefix, QCodeReference codeReference, Class<?>... anyOfExpectedClasses) void
-
Constructor Details
-
QInstanceValidator
public QInstanceValidator()
-
-
Method Details
-
validate
- Throws:
QInstanceValidationException
-
revalidate
- Throws:
QInstanceValidationException
-
addValidatorPlugin
-
removeAllValidatorPlugins
public static void removeAllValidatorPlugins() -
getValidatorPlugins
Getter for validatorPlugins -
validateField
public void validateField(QInstance qInstance, String prefix, Optional<QTableMetaData> table, QFieldMetaData field) run validation on a field - optionally within the context of a table. -
validateFieldSupplementalMetaData
-
validateQueryFilter
public void validateQueryFilter(QInstance qInstance, String context, QTableMetaData table, QQueryFilter queryFilter, List<QueryJoin> queryJoins) -
validateSimpleCodeReference
public void validateSimpleCodeReference(String prefix, QCodeReference codeReference, Class<?>... anyOfExpectedClasses) -
assertCondition
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
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
-
getErrors
-