Class ObjectSchema


  • public class ObjectSchema
    extends Schema
    Object schema validator.
    • Constructor Detail

      • ObjectSchema

        public ObjectSchema​(ObjectSchema.Builder builder)
        Constructor.
        Parameters:
        builder - the builder object containing validation criteria
    • Method Detail

      • getMaxProperties

        public Integer getMaxProperties()
      • getMinProperties

        public Integer getMinProperties()
      • getRequiredProperties

        public List<String> getRequiredProperties()
      • getSchemaDependencies

        public Map<String,​Schema> getSchemaDependencies()
      • getSchemaOfAdditionalProperties

        public Schema getSchemaOfAdditionalProperties()
      • getPropertyNameSchema

        public Schema getPropertyNameSchema()
      • permitsAdditionalProperties

        public boolean permitsAdditionalProperties()
      • requiresObject

        public boolean requiresObject()
      • definesProperty

        public boolean definesProperty​(String field)
        Description copied from class: Schema
        Determines if this Schema instance defines any restrictions for the object property denoted by field. The field should be a JSON pointer, denoting the property to be queried.

        For example the field "#/rectangle/a" is defined by the following schema:

         
         objectWithSchemaRectangleDep" : {
           "type" : "object",
           "dependencies" : {
               "d" : {
                   "type" : "object",
                   "properties" : {
                       "rectangle" : {"$ref" : "#/definitions/Rectangle" }
                   }
               }
           },
           "definitions" : {
               "size" : {
                   "type" : "number",
                   "minimum" : 0
               },
               "Rectangle" : {
                   "type" : "object",
                   "properties" : {
                       "a" : {"$ref" : "#/definitions/size"},
                       "b" : {"$ref" : "#/definitions/size"}
                   }
               }
            }
         }
         
         
        The default implementation of this method always returns false.
        Overrides:
        definesProperty in class Schema
        Parameters:
        field - should be a JSON pointer in its string representation.
        Returns:
        true if the propertty denoted by field is defined by this schema instance
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Schema
      • canEqual

        protected boolean canEqual​(Object other)
        Description copied from class: Schema
        Since we add state in subclasses, but want those subclasses to be non final, this allows us to have equals methods that satisfy the equals contract.

        http://www.artima.com/lejava/articles/equality.html

        Overrides:
        canEqual in class Schema
        Parameters:
        other - the subject of comparison
        Returns:
        true if this can be equal to other