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

io.smallrye.graphql.client.impl.GraphQLErrorImpl Maven / Gradle / Ivy

The newest version!
package io.smallrye.graphql.client.impl;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import io.smallrye.graphql.client.GraphQLError;

public class GraphQLErrorImpl implements GraphQLError {
    private String message;
    private List> locations;
    private Object[] path;
    private Map extensions;
    private Map otherFields;

    public GraphQLErrorImpl() {
    }

    public GraphQLErrorImpl(String message, List> locations, Object[] path, Map extensions,
            Map otherFields) {
        this.message = message;
        this.locations = locations;
        this.path = path;
        this.extensions = extensions;
        this.otherFields = otherFields;
    }

    public String getMessage() {
        return message;
    }

    public List> getLocations() {
        return locations;
    }

    public Object[] getPath() {
        return path;
    }

    public Map getExtensions() {
        return extensions;
    }

    @Override
    public Map getOtherFields() {
        return otherFields;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public void setLocations(List> locations) {
        this.locations = locations;
    }

    public void setPath(Object[] path) {
        this.path = path;
    }

    public void setExtensions(Map extensions) {
        this.extensions = extensions;
    }

    public void setOtherFields(Map otherFields) {
        this.otherFields = otherFields;
    }

    @Override
    public String toString() {
        String other = (otherFields == null || otherFields.isEmpty()) ? "" : ", otherFields=" + otherFields;
        return "Error{message=" + message +
                ", locations=" + locations +
                ", path=" + Arrays.toString(path) +
                ", extensions=" + extensions +
                other + '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        GraphQLErrorImpl that = (GraphQLErrorImpl) o;
        return Objects.equals(message, that.message) && Objects.equals(locations, that.locations)
                && Arrays.equals(path, that.path) && Objects.equals(extensions, that.extensions)
                && Objects.equals(otherFields, that.otherFields);
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(message, locations, extensions, otherFields);
        result = 31 * result + Arrays.hashCode(path);
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy