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

com.dimajix.shaded.everit.schema.event.ConditionalSchemaMismatchEvent Maven / Gradle / Ivy

There is a newer version: 1.2.0-synapse3.3-spark3.3-hadoop3.3
Show newest version
package com.dimajix.shaded.everit.schema.event;

import java.util.Objects;

import com.dimajix.shaded.everit.schema.ConditionalSchema;
import com.dimajix.shaded.everit.schema.ValidationException;
import com.dimajix.shaded.json.JSONObject;

public class ConditionalSchemaMismatchEvent extends ConditionalSchemaValidationEvent implements MismatchEvent {

    private final ValidationException failure;

    public ConditionalSchemaMismatchEvent(ConditionalSchema schema, Object instance, Keyword keyword, ValidationException failure) {
        super(schema, instance, keyword);
        this.failure = failure;
    }

    @Override public ValidationException getFailure() {
        return failure;
    }

    @Override void describeTo(JSONObject obj) {
        obj.put("type", "mismatch");
        obj.put("keyword", keyword.toString());
        obj.put("failure", failure.toJSON());
    }

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy