@@ -26,13 +26,9 @@ public class ExecutionInput {
2626 private final ExecutionId executionId ;
2727
2828
29- public ExecutionInput (String query , String operationName , Object context , Object root , Map <String , Object > variables ) {
30- this (query , operationName , context , root , variables , new DataLoaderRegistry (), null , null );
31- }
32-
3329 @ Internal
3430 private ExecutionInput (String query , String operationName , Object context , Object root , Map <String , Object > variables , DataLoaderRegistry dataLoaderRegistry , CacheControl cacheControl , ExecutionId executionId ) {
35- this .query = query ;
31+ this .query = assertNotNull ( query , "query can't be null" ) ;
3632 this .operationName = operationName ;
3733 this .context = context ;
3834 this .root = root ;
@@ -103,18 +99,19 @@ public ExecutionId getExecutionId() {
10399 * the current values and allows you to transform it how you want.
104100 *
105101 * @param builderConsumer the consumer code that will be given a builder to transform
102+ *
106103 * @return a new ExecutionInput object based on calling build on that builder
107104 */
108105 public ExecutionInput transform (Consumer <Builder > builderConsumer ) {
109106 Builder builder = new Builder ()
110- .query (this .query )
111- .operationName (this .operationName )
112- .context (this .context )
113- .root (this .root )
114- .dataLoaderRegistry (this .dataLoaderRegistry )
115- .cacheControl (this .cacheControl )
116- .variables (this .variables )
117- .executionId (executionId );
107+ .query (this .query )
108+ .operationName (this .operationName )
109+ .context (this .context )
110+ .root (this .root )
111+ .dataLoaderRegistry (this .dataLoaderRegistry )
112+ .cacheControl (this .cacheControl )
113+ .variables (this .variables )
114+ .executionId (executionId );
118115
119116 builderConsumer .accept (builder );
120117
@@ -125,14 +122,14 @@ public ExecutionInput transform(Consumer<Builder> builderConsumer) {
125122 @ Override
126123 public String toString () {
127124 return "ExecutionInput{" +
128- "query='" + query + '\'' +
129- ", operationName='" + operationName + '\'' +
130- ", context=" + context +
131- ", root=" + root +
132- ", variables=" + variables +
133- ", dataLoaderRegistry=" + dataLoaderRegistry +
134- ", executionId= " + executionId +
135- '}' ;
125+ "query='" + query + '\'' +
126+ ", operationName='" + operationName + '\'' +
127+ ", context=" + context +
128+ ", root=" + root +
129+ ", variables=" + variables +
130+ ", dataLoaderRegistry=" + dataLoaderRegistry +
131+ ", executionId= " + executionId +
132+ '}' ;
136133 }
137134
138135 /**
@@ -146,6 +143,7 @@ public static Builder newExecutionInput() {
146143 * Creates a new builder of ExecutionInput objects with the given query
147144 *
148145 * @param query the query to execute
146+ *
149147 * @return a new builder of ExecutionInput objects
150148 */
151149 public static Builder newExecutionInput (String query ) {
@@ -164,7 +162,7 @@ public static class Builder {
164162 private ExecutionId executionId = null ;
165163
166164 public Builder query (String query ) {
167- this .query = query ;
165+ this .query = assertNotNull ( query , "query can't be null" ) ;
168166 return this ;
169167 }
170168
@@ -175,7 +173,9 @@ public Builder operationName(String operationName) {
175173
176174 /**
177175 * A default one will be assigned, but you can set your own.
176+ *
178177 * @param executionId an execution id object
178+ *
179179 * @return this builder
180180 */
181181 public Builder executionId (ExecutionId executionId ) {
@@ -187,6 +187,7 @@ public Builder executionId(ExecutionId executionId) {
187187 * By default you will get a {@link GraphQLContext} object but you can set your own.
188188 *
189189 * @param context the context object to use
190+ *
190191 * @return this builder
191192 */
192193 public Builder context (Object context ) {
@@ -211,7 +212,7 @@ public Builder root(Object root) {
211212 }
212213
213214 public Builder variables (Map <String , Object > variables ) {
214- this .variables = variables ;
215+ this .variables = assertNotNull ( variables , "variables map can't be null" ) ;
215216 return this ;
216217 }
217218
@@ -221,6 +222,7 @@ public Builder variables(Map<String, Object> variables) {
221222 * instances as this will create unexpected results.
222223 *
223224 * @param dataLoaderRegistry a registry of {@link org.dataloader.DataLoader}s
225+ *
224226 * @return this builder
225227 */
226228 public Builder dataLoaderRegistry (DataLoaderRegistry dataLoaderRegistry ) {
0 commit comments