All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fasterxml.jackson.module.jsonSchema.types.IntegerSchema Maven / Gradle / Ivy

Go to download

Add-on module for Jackson (http://jackson.codehaus.org) to support JSON Schema (http://tools.ietf.org/html/draft-zyp-json-schema-03) version 3 generation.

There is a newer version: 2.17.1
Show newest version
package com.fasterxml.jackson.module.jsonSchema.types;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes;
import com.fasterxml.jackson.module.jsonSchema.JsonSchema;

/**
 * This class represents a {@link JsonSchema} as an integer type
 * @author jphelan
 *
 */
public class IntegerSchema extends NumberSchema
{
	/**
	 * This attribute defines what value the number instance must be
	   divisible by with no remainder (the result of the division must be an
	   integer.)  The value of this attribute SHOULD NOT be 0.
	 */
	private Integer divisibleBy;
	
     @Override
     public boolean isIntegerSchema() { return true; }

     @Override
     public JsonFormatTypes getType() {
         return JsonFormatTypes.INTEGER;
     }

     @Override
     public IntegerSchema asIntegerSchema() { return this; }

     @JsonProperty
     public Integer getDivisibleBy() {
         return divisibleBy;
     }
    
     public void setDivisibleBy(Integer divisibleBy) {
         this.divisibleBy = divisibleBy;
     }

     @Override
	public boolean equals(Object obj)
     {
         if (obj == this) return true;
         if (obj instanceof IntegerSchema) {
			IntegerSchema that = (IntegerSchema)obj;
			return equals(getDivisibleBy(), that.getDivisibleBy()) &&
				super.equals(obj);
         }
         return false;
	} 
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy