Class ResearchObjectValidator


  • public class ResearchObjectValidator
    extends java.lang.Object
    A class for validating a Research Objects using a provided ResearchObjectProfile, raising a ProfileValidationException if the given content is not valid.
    See Also:
    ProfileValidationException, ResearchObjectProfile
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void validate​(com.fasterxml.jackson.databind.JsonNode content)
      Validate the given ResearchObject content.
      void validate​(org.json.JSONObject content)
      Validate the given ResearchObject content.
      void validateFieldValue​(java.lang.String field, com.fasterxml.jackson.databind.JsonNode value)
      Validate a single field of a ResearchObject.
      void validateListFieldValue​(java.lang.String field, com.fasterxml.jackson.databind.JsonNode value)
      Validate a single list field of a ResearchObject.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResearchObjectValidator

        public ResearchObjectValidator​(ResearchObjectProfile profile)
        Parameters:
        profile - The profile to validate against.
    • Method Detail

      • validate

        public void validate​(com.fasterxml.jackson.databind.JsonNode content)
                      throws ProfileValidationException
        Validate the given ResearchObject content. Converts to org.json JSONObject beforehand.
        Parameters:
        content - The ResearchObject's content to validate, as Jackson JSON.
        Throws:
        ProfileValidationException
      • validate

        public void validate​(org.json.JSONObject content)
                      throws ProfileValidationException
        Validate the given ResearchObject content.
        Parameters:
        content - The ResearchObject's content to validate, as org.json JSON.
        Throws:
        ProfileValidationException
      • validateFieldValue

        public void validateFieldValue​(java.lang.String field,
                                       com.fasterxml.jackson.databind.JsonNode value)
                                throws ProfileValidationException
        Validate a single field of a ResearchObject.
        Parameters:
        field - The field name.
        value - Its value.
        Throws:
        ProfileValidationException
      • validateListFieldValue

        public void validateListFieldValue​(java.lang.String field,
                                           com.fasterxml.jackson.databind.JsonNode value)
                                    throws ProfileValidationException
        Validate a single list field of a ResearchObject.
        Parameters:
        field - The field name.
        value - Its value.
        Throws:
        ProfileValidationException