Repository navigation
#377 - have the ability to know and capture all fields in a data fetcher #401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bbakerman
merged 6 commits into
graphql-java:master
from
bbakerman:377-field-selection-in-data-fetchers
May 10, 2017
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5d487ea
#377 - have the ability to know and capture all fields in a data fetcher
bbakerman 80b4fe9
ExecutionContext is not longer API but there is a replacement
bbakerman bab1191
Merge remote-tracking branch 'upstream/master' into 377-field-selecti…
bbakerman 158762f
Added a selection set interface instead as suggested. This means fie…
bbakerman a75cdea
Made DataFetchingFieldSelectionSet a supplier since it really is
bbakerman 11abe76
Merge remote-tracking branch 'upstream/master' into 377-field-selecti…
bbakerman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/main/java/graphql/execution/FieldCollectorParameters.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| package graphql.execution; | ||
|
|
||
| import graphql.Assert; | ||
| import graphql.language.FragmentDefinition; | ||
| import graphql.schema.GraphQLObjectType; | ||
| import graphql.schema.GraphQLSchema; | ||
|
|
||
| import java.util.LinkedHashMap; | ||
| import java.util.Map; | ||
|
|
||
| public class FieldCollectorParameters { | ||
| private final GraphQLSchema graphQLSchema; | ||
| private final Map<String, FragmentDefinition> fragmentsByName; | ||
| private final Map<String, Object> variables; | ||
| private final GraphQLObjectType objectType; | ||
|
|
||
| public GraphQLSchema getGraphQLSchema() { | ||
| return graphQLSchema; | ||
| } | ||
|
|
||
| public Map<String, FragmentDefinition> getFragmentsByName() { | ||
| return fragmentsByName; | ||
| } | ||
|
|
||
| public Map<String, Object> getVariables() { | ||
| return variables; | ||
| } | ||
|
|
||
| public GraphQLObjectType getObjectType() { | ||
| return objectType; | ||
| } | ||
|
|
||
| private FieldCollectorParameters(GraphQLSchema graphQLSchema, Map<String, Object> variables, Map<String, FragmentDefinition> fragmentsByName, GraphQLObjectType objectType) { | ||
| this.fragmentsByName = fragmentsByName; | ||
| this.graphQLSchema = graphQLSchema; | ||
| this.variables = variables; | ||
| this.objectType = objectType; | ||
| } | ||
|
|
||
| public static Builder newParameters(GraphQLSchema graphQLSchema, GraphQLObjectType objectType) { | ||
| Assert.assertNotNull(graphQLSchema, "You must provide a schema"); | ||
| Assert.assertNotNull(objectType, "You must provide an object type"); | ||
| return new Builder().schema(graphQLSchema).objectType(objectType); | ||
| } | ||
|
|
||
| public static class Builder { | ||
| private GraphQLSchema graphQLSchema; | ||
| private Map<String, FragmentDefinition> fragmentsByName = new LinkedHashMap<>(); | ||
| private Map<String, Object> variables = new LinkedHashMap<>(); | ||
| private GraphQLObjectType objectType; | ||
|
|
||
| public Builder schema(GraphQLSchema graphQLSchema) { | ||
| this.graphQLSchema = graphQLSchema; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder objectType(GraphQLObjectType objectType) { | ||
| this.objectType = objectType; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder fragments(Map<String, FragmentDefinition> fragmentsByName) { | ||
| this.fragmentsByName.putAll(fragmentsByName); | ||
| return this; | ||
| } | ||
|
|
||
| public Builder variables(Map<String, Object> variables) { | ||
| this.variables.putAll(variables); | ||
| return this; | ||
| } | ||
|
|
||
| public FieldCollectorParameters build() { | ||
| return new FieldCollectorParameters(graphQLSchema, variables, fragmentsByName, objectType); | ||
| } | ||
|
|
||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice how visitedFragments is NEVER used. Thats why I took it out of the public method signature