Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
307 changes: 180 additions & 127 deletions src/main/java/graphql/execution/batched/BatchedExecutionStrategy.java

Large diffs are not rendered by default.

66 changes: 0 additions & 66 deletions src/main/java/graphql/execution/batched/ChildDataCollector.java

This file was deleted.

41 changes: 41 additions & 0 deletions src/main/java/graphql/execution/batched/ExecutionNode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package graphql.execution.batched;

import graphql.language.Field;
import graphql.schema.GraphQLObjectType;

import java.util.List;
import java.util.Map;

class ExecutionNode {

private final GraphQLObjectType type;
private final Map<String, List<Field>> fields;
private final List<MapOrList> parentResults;
private final List<Object> sources;

public ExecutionNode(GraphQLObjectType type,
Map<String, List<Field>> fields,
List<MapOrList> parentResults,
List<Object> sources) {
this.type = type;
this.fields = fields;
this.parentResults = parentResults;
this.sources = sources;
}

public GraphQLObjectType getType() {
return type;
}

public Map<String, List<Field>> getFields() {
return fields;
}

public List<MapOrList> getParentResults() {
return parentResults;
}

public List<Object> getSources() {
return sources;
}
}
20 changes: 20 additions & 0 deletions src/main/java/graphql/execution/batched/FetchedValue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package graphql.execution.batched;

public class FetchedValue {

private final MapOrList mapOrList;
private final Object value;

public FetchedValue(MapOrList parentResult, Object value) {
this.mapOrList = parentResult;
this.value = value;
}

public MapOrList getParentResult() {
return mapOrList;
}

public Object getValue() {
return value;
}
}
34 changes: 0 additions & 34 deletions src/main/java/graphql/execution/batched/GraphQLExecutionNode.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

57 changes: 57 additions & 0 deletions src/main/java/graphql/execution/batched/MapOrList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package graphql.execution.batched;

import graphql.Internal;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

@Internal
public class MapOrList {


private Map<String, Object> map;
private List<Object> list;

public static MapOrList createList(List<Object> list) {
MapOrList mapOrList = new MapOrList();
mapOrList.list = list;
return mapOrList;
}

public static MapOrList createMap(Map<String, Object> map) {
MapOrList mapOrList = new MapOrList();
mapOrList.map = map;
return mapOrList;
}

public MapOrList createAndPutMap(String key) {
Map<String, Object> map = new LinkedHashMap<>();
putOrAdd(key, map);
return createMap(map);
}

public MapOrList createAndPutList(String key) {
List<Object> resultList = new ArrayList<>();
putOrAdd(key, resultList);
return createList(resultList);
}

public void putOrAdd(String fieldName, Object value) {
if (this.map != null) {
this.map.put(fieldName, value);
} else {
this.list.add(value);
}
}


public Object toObject() {
if (this.map != null) {
return this.map;
} else {
return this.list;
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/graphql/schema/GraphQLObjectType.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public String toString() {
return "GraphQLObjectType{" +
"name='" + name + '\'' +
", description='" + description + '\'' +
", fieldDefinitionsByName=" + fieldDefinitionsByName +
", fieldDefinitionsByName=" + fieldDefinitionsByName.keySet() +
", interfaces=" + interfaces +
'}';
}
Expand Down
Loading