FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
graphql-java/src/main/java/graphql/ExecutionResultImpl.java at master · feifeiq/graphql-java · GitHub
feifeiq
/
graphql-java
Public
forked from
graphql-java/graphql-java
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
graphql-java
/
src
/
main
/
java
/
graphql
/
ExecutionResultImpl.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
61 lines (48 loc) · 1.52 KB
Breadcrumbs
graphql-java
/
src
/
main
/
java
/
graphql
/
ExecutionResultImpl.java
Copy path
File metadata and controls
61 lines (48 loc) · 1.52 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package
graphql
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.
Collections
;
import
java
.
util
.
LinkedHashMap
;
import
java
.
util
.
List
;
import
java
.
util
.
Map
;
@
Internal
public
class
ExecutionResultImpl
implements
ExecutionResult
{
private
final
List
<
GraphQLError
>
errors
=
new
ArrayList
<>();
private
final
Object
data
;
private
final
transient
boolean
dataPresent
;
public
ExecutionResultImpl
(
GraphQLError
error
) {
this
(
false
,
null
,
Collections
.
singletonList
(
error
));
}
public
ExecutionResultImpl
(
List
<?
extends
GraphQLError
>
errors
) {
this
(
false
,
null
,
errors
);
}
public
ExecutionResultImpl
(
Object
data
,
List
<?
extends
GraphQLError
>
errors
) {
this
(
true
,
data
,
errors
);
}
private
ExecutionResultImpl
(
boolean
dataPresent
,
Object
data
,
List
<?
extends
GraphQLError
>
errors
) {
this
.
dataPresent
=
dataPresent
;
this
.
data
=
data
;
if
(
errors
!=
null
&& !
errors
.
isEmpty
()) {
this
.
errors
.
addAll
(
errors
);
}
}
@
Override
public
<
T
>
T
getData
() {
//noinspection unchecked
return
(
T
)
data
;
}
@
Override
public
List
<
GraphQLError
>
getErrors
() {
return
new
ArrayList
<>(
errors
);
}
@
Override
public
Map
<
String
,
Object
>
toSpecification
() {
Map
<
String
,
Object
>
result
=
new
LinkedHashMap
<>();
if
(
dataPresent
) {
result
.
put
(
"data"
,
data
);
}
if
(
errors
!=
null
&& !
errors
.
isEmpty
()) {
result
.
put
(
"errors"
,
errors
);
}
return
result
;
}
}
Back
|
FazBrowse Home
|
New Git URL