Class AttributeValidator
- java.lang.Object
-
- org.gcube.informationsystem.types.impl.validator.AttributeValidator
-
public class AttributeValidator extends Object
Used to validate the value fo one attribute against the attribute definition- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description protected AttributeDefinitionattributeDefinitionprotected AttributeValidatorReportattributeValidatorReportprotected static org.slf4j.Loggerloggerprotected booleanstopOnErrorprotected org.gcube.com.fasterxml.jackson.databind.JsonNodevalue
-
Constructor Summary
Constructors Constructor Description AttributeValidator(AttributeDefinition attributeDefinition, org.gcube.com.fasterxml.jackson.databind.JsonNode value)AttributeValidator(AttributeDefinition attributeDefinition, org.gcube.com.fasterxml.jackson.databind.JsonNode value, boolean stopOnError)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddError(StringBuffer sb)Add an error message to the report and log itprotected booleancheckPropertyTypeCompliance(org.gcube.com.fasterxml.jackson.databind.JsonNode value, String expectedPropertyType, StringBuffer sb, boolean fromMultipleInstaces)AttributeDefinitiongetAttributeDefinition()AttributeValidatorReportgetAttributeValidatorReport()protected StringBuffergetNewStringBuffer(StringBuffer sb)protected StringBuffergetPropertyStringBuffer(StringBuffer sb, String expectedPropertyType, boolean fromMultipleInstaces)org.gcube.com.fasterxml.jackson.databind.JsonNodegetValue()booleanisStopOnError()protected booleantypeNotCompliant(org.gcube.com.fasterxml.jackson.databind.JsonNode value, String expectedType, StringBuffer sb)booleanvalidate()protected booleanvalidate(String expectedType, org.gcube.com.fasterxml.jackson.databind.JsonNode value, StringBuffer sb)protected booleanvalidateByte(org.gcube.com.fasterxml.jackson.databind.JsonNode value, StringBuffer sb)protected booleanvalidateDate(org.gcube.com.fasterxml.jackson.databind.JsonNode value, StringBuffer sb)protected booleanvalidateNumber(Number number, StringBuffer sb)Validate a number against the attribute definitionprotected booleanvalidateString(org.gcube.com.fasterxml.jackson.databind.JsonNode value, StringBuffer sb)
-
-
-
Field Detail
-
logger
protected static org.slf4j.Logger logger
-
stopOnError
protected final boolean stopOnError
-
attributeDefinition
protected final AttributeDefinition attributeDefinition
-
value
protected final org.gcube.com.fasterxml.jackson.databind.JsonNode value
-
attributeValidatorReport
protected final AttributeValidatorReport attributeValidatorReport
-
-
Constructor Detail
-
AttributeValidator
public AttributeValidator(AttributeDefinition attributeDefinition, org.gcube.com.fasterxml.jackson.databind.JsonNode value)
-
AttributeValidator
public AttributeValidator(AttributeDefinition attributeDefinition, org.gcube.com.fasterxml.jackson.databind.JsonNode value, boolean stopOnError)
-
-
Method Detail
-
isStopOnError
public boolean isStopOnError()
-
getAttributeDefinition
public AttributeDefinition getAttributeDefinition()
-
getValue
public org.gcube.com.fasterxml.jackson.databind.JsonNode getValue()
-
getAttributeValidatorReport
public AttributeValidatorReport getAttributeValidatorReport()
-
addError
protected void addError(StringBuffer sb)
Add an error message to the report and log it- Parameters:
sb-
-
getNewStringBuffer
protected StringBuffer getNewStringBuffer(StringBuffer sb)
-
validateNumber
protected boolean validateNumber(Number number, StringBuffer sb)
Validate a number against the attribute definition- Parameters:
number-sb-- Returns:
-
typeNotCompliant
protected boolean typeNotCompliant(org.gcube.com.fasterxml.jackson.databind.JsonNode value, String expectedType, StringBuffer sb)
-
validateString
protected boolean validateString(org.gcube.com.fasterxml.jackson.databind.JsonNode value, StringBuffer sb)
-
validateDate
protected boolean validateDate(org.gcube.com.fasterxml.jackson.databind.JsonNode value, StringBuffer sb)
-
validateByte
protected boolean validateByte(org.gcube.com.fasterxml.jackson.databind.JsonNode value, StringBuffer sb)
-
getPropertyStringBuffer
protected StringBuffer getPropertyStringBuffer(StringBuffer sb, String expectedPropertyType, boolean fromMultipleInstaces)
-
checkPropertyTypeCompliance
protected boolean checkPropertyTypeCompliance(org.gcube.com.fasterxml.jackson.databind.JsonNode value, String expectedPropertyType, StringBuffer sb, boolean fromMultipleInstaces)
-
validate
protected boolean validate(String expectedType, org.gcube.com.fasterxml.jackson.databind.JsonNode value, StringBuffer sb)
-
validate
public boolean validate()
-
-