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

hydraql.shaded.fastjson2.schema.NullSchema Maven / Gradle / Ivy

package hydraql.shaded.fastjson2.schema;

import hydraql.shaded.fastjson2.JSONObject;

import java.util.Objects;

final class NullSchema
        extends JSONSchema {
    NullSchema(JSONObject input) {
        super(input);
    }

    @Override
    public Type getType() {
        return Type.Null;
    }

    @Override
    public ValidateResult validate(Object value) {
        if (value == null) {
            return SUCCESS;
        }

        return new ValidateResult(false, "expect type %s, but %s", Type.Null, value.getClass());
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        hydraql.shaded.fastjson2.schema.NullSchema that = (hydraql.shaded.fastjson2.schema.NullSchema) o;
        return Objects.equals(title, that.title) && Objects.equals(description, that.description);
    }

    @Override
    public int hashCode() {
        return Objects.hash(title, description);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy