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

org.everit.json.schema.event.SchemaReferencedEvent Maven / Gradle / Ivy

Go to download

Implementation of the JSON Schema Core Draft v4 specification built with the org.json API

There is a newer version: 1.14.4
Show newest version
package org.everit.json.schema.event;

import java.util.Objects;

import org.everit.json.schema.ReferenceSchema;
import org.everit.json.schema.Schema;
import org.json.JSONObject;

public class SchemaReferencedEvent extends ValidationEvent {

    private final Schema referredSchema;

    public SchemaReferencedEvent(ReferenceSchema schema, Object instance, Schema referredSchema) {
        super(schema, instance);
        this.referredSchema = referredSchema;
    }

    @Override
    void describeTo(JSONObject obj) {
        obj.put("type", "ref");
    }

    public Schema getReferredSchema() {
        return referredSchema;
    }

    @Override public boolean equals(Object o) {
        if (this == o)
            return true;
        if (!canEqual(o)) {
            return false;
        }
        if (!super.equals(o))
            return false;
        SchemaReferencedEvent that = (SchemaReferencedEvent) o;
        return referredSchema.equals(that.referredSchema);
    }

    @Override public int hashCode() {
        return Objects.hash(super.hashCode(), referredSchema);
    }

    @Override boolean canEqual(Object o) {
        return o instanceof SchemaReferencedEvent;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy