Class ObjectNodeValidator
- java.lang.Object
-
- org.gcube.informationsystem.types.impl.validator.ObjectNodeValidator
-
public class ObjectNodeValidator extends Object
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
Fields Modifier and Type Field Description protected List<? extends AttributeDefinition>attributeDefinitionsThe attribute definitions.protected static org.slf4j.LoggerloggerThe logger.protected org.gcube.com.fasterxml.jackson.databind.node.ObjectNodenodeToValidateThe node to validate.protected booleanstopOnErrorA flag indicating whether to stop on the first error.protected ValidatorReportvalidatorReportThe validator report.
-
Constructor Summary
Constructors Constructor Description ObjectNodeValidator(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValidatorReportgetValidatorReport()Returns the validator report.booleanisValid()Checks if the validation was successful.booleanvalidate()Validates the node.
-
-
-
Field Detail
-
logger
protected static org.slf4j.Logger logger
The logger.
-
nodeToValidate
protected final org.gcube.com.fasterxml.jackson.databind.node.ObjectNode nodeToValidate
The node to validate.
-
attributeDefinitions
protected final List<? extends AttributeDefinition> attributeDefinitions
The attribute definitions.
-
stopOnError
protected final boolean stopOnError
A flag indicating whether to stop on the first error.
-
validatorReport
protected ValidatorReport validatorReport
The validator report.
-
-
Constructor Detail
-
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 Detail
-
getValidatorReport
public ValidatorReport 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.
-
-