Class AttributeValidator


  • public class AttributeValidator
    extends Object
    Used to validate the value fo one attribute against the attribute definition
    Author:
    Luca Frosini (ISTI - CNR)
    • Field Detail

      • logger

        protected static org.slf4j.Logger logger
      • stopOnError

        protected final boolean stopOnError
      • value

        protected final org.gcube.com.fasterxml.jackson.databind.JsonNode value
    • 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()
      • getValue

        public org.gcube.com.fasterxml.jackson.databind.JsonNode getValue()
      • addError

        protected void addError​(StringBuffer sb)
        Add an error message to the report and log it
        Parameters:
        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()