Class ObjectNodeValidator
java.lang.Object
org.gcube.informationsystem.types.impl.validator.ObjectNodeValidator
This class is used to validate an ObjectNode against a list of AttributeDefinitions.
It produces a report with the validation results.
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<? extends AttributeDefinition>The attribute definitions.protected static org.slf4j.LoggerThe logger.protected final org.gcube.com.fasterxml.jackson.databind.node.ObjectNodeThe node to validate.protected final booleanA flag indicating whether to stop on the first error.protected ValidatorReportThe validator report. -
Constructor Summary
ConstructorsConstructorDescriptionObjectNodeValidator(org.gcube.com.fasterxml.jackson.databind.node.ObjectNode nodeToValidate, List<? extends AttributeDefinition> attributeDefinitions) Constructs a new validator.ObjectNodeValidator(org.gcube.com.fasterxml.jackson.databind.node.ObjectNode nodeToValidate, List<? extends AttributeDefinition> attributeDefinitions, Boolean stopOnError) Constructs a new validator with the option to stop on the first error. -
Method Summary
-
Field Details
-
logger
protected static org.slf4j.Logger loggerThe logger. -
nodeToValidate
protected final org.gcube.com.fasterxml.jackson.databind.node.ObjectNode nodeToValidateThe node to validate. -
attributeDefinitions
The attribute definitions. -
stopOnError
protected final boolean stopOnErrorA flag indicating whether to stop on the first error. -
validatorReport
The validator report.
-
-
Constructor Details
-
ObjectNodeValidator
public ObjectNodeValidator(org.gcube.com.fasterxml.jackson.databind.node.ObjectNode nodeToValidate, List<? extends AttributeDefinition> attributeDefinitions) Constructs a new validator.- Parameters:
nodeToValidate- The node to validate.attributeDefinitions- The attribute definitions.
-
ObjectNodeValidator
public ObjectNodeValidator(org.gcube.com.fasterxml.jackson.databind.node.ObjectNode nodeToValidate, List<? extends AttributeDefinition> attributeDefinitions, Boolean stopOnError) Constructs a new validator with the option to stop on the first error.- Parameters:
nodeToValidate- The node to validate.attributeDefinitions- The attribute definitions.stopOnError-trueto stop on the first error.
-
-
Method Details
-
getValidatorReport
Returns the validator report.- Returns:
- The validator report.
-
isValid
public boolean isValid()Checks if the validation was successful.- Returns:
trueif the validation was successful.
-
validate
public boolean validate()Validates the node.- Returns:
trueif the validation was successful.
-