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

graphql.GraphQLError Maven / Gradle / Ivy

The newest version!
package graphql;


import graphql.language.SourceLocation;

import java.util.List;

public interface GraphQLError {

    String getMessage();

    List getLocations();

    ErrorType getErrorType();


    /**
     * This little helper allows GraphQlErrors to implement
     * common things (hashcode/ equals) more easily
     */
    @SuppressWarnings("SimplifiableIfStatement")
    class Helper {

        public static int hashCode(GraphQLError dis) {
            int result = dis.getMessage() != null ? dis.getMessage().hashCode() : 0;
            result = 31 * result + (dis.getLocations() != null ? dis.getLocations().hashCode() : 0);
            result = 31 * result + dis.getErrorType().hashCode();
            return result;
        }

        public static boolean equals(GraphQLError dis, Object o) {
            if (dis == o) {
                return true;
            }
            if (o == null || dis.getClass() != o.getClass()) return false;

            GraphQLError dat = (GraphQLError) o;

            if (dis.getMessage() != null ? !dis.getMessage().equals(dat.getMessage()) : dat.getMessage() != null)
                return false;
            if (dis.getLocations() != null ? !dis.getLocations().equals(dat.getLocations()) : dat.getLocations() != null)
                return false;
            return dis.getErrorType() == dat.getErrorType();
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy