forked from graphql-java/graphql-java
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGraphQLError.java
More file actions
43 lines (31 loc) · 1.25 KB
/
GraphQLError.java
File metadata and controls
43 lines (31 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package graphql;
import graphql.language.SourceLocation;
import java.util.List;
public interface GraphQLError {
String getMessage();
List<SourceLocation> 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, GraphQLError dat) {
if (dis == da
38DF
t) {
return true;
}
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();
}
}
}