Skip to content

Commit 64e686f

Browse files
Rename DeferExecution to NormalizedDeferredExecution
This will align the name of this class, which is in the 'incremental' package, with 'DeferredExecution', which is in the 'execution' package.
1 parent 7c381cc commit 64e686f

8 files changed

Lines changed: 100 additions & 100 deletions

src/main/java/graphql/execution/incremental/DeferredExecution.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package graphql.execution.incremental;
22

33
import graphql.ExperimentalApi;
4-
import graphql.normalized.incremental.DeferExecution;
4+
import graphql.normalized.incremental.NormalizedDeferredExecution;
55

66
import javax.annotation.Nullable;
77

88
/**
99
* Represents details about the defer execution that can be associated with a {@link graphql.execution.MergedField}.
1010
* <p>
11-
* This representation is used during graphql execution. Check {@link DeferExecution}
11+
* This representation is used during graphql execution. Check {@link NormalizedDeferredExecution}
1212
* for the normalized representation of @defer.
1313
*/
1414
@ExperimentalApi

src/main/java/graphql/normalized/ENFMerger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ && isFieldInSharedInterface(field, fieldInGroup, schema)
7575

7676
if (deferSupport) {
7777
// Move defer executions from removed field into the merged field's entry
78-
first.addDeferExecutions(next.getDeferExecutions());
78+
first.addDeferredExecutions(next.getDeferredExecutions());
7979
}
8080
}
8181
first.setObjectTypeNames(mergedObjects);

src/main/java/graphql/normalized/ExecutableNormalizedField.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import graphql.collect.ImmutableKit;
1111
import graphql.introspection.Introspection;
1212
import graphql.language.Argument;
13-
import graphql.normalized.incremental.DeferExecution;
13+
import graphql.normalized.incremental.NormalizedDeferredExecution;
1414
import graphql.schema.GraphQLFieldDefinition;
1515
import graphql.schema.GraphQLInterfaceType;
1616
import graphql.schema.GraphQLNamedOutputType;
@@ -66,7 +66,7 @@ public class ExecutableNormalizedField {
6666
private final int level;
6767

6868
// Mutable List on purpose: it is modified after creation
69-
private final LinkedHashSet<DeferExecution> deferExecutions;
69+
private final LinkedHashSet<NormalizedDeferredExecution> deferredExecutions;
7070

7171
private ExecutableNormalizedField(Builder builder) {
7272
this.alias = builder.alias;
@@ -78,7 +78,7 @@ private ExecutableNormalizedField(Builder builder) {
7878
this.children = builder.children;
7979
this.level = builder.level;
8080
this.parent = builder.parent;
81-
this.deferExecutions = builder.deferExecutions;
81+
this.deferredExecutions = builder.deferredExecutions;
8282
}
8383

8484
/**
@@ -262,13 +262,13 @@ public void clearChildren() {
262262
}
263263

264264
@Internal
265-
public void setDeferExecutions(Collection<DeferExecution> deferExecutions) {
266-
this.deferExecutions.clear();
267-
this.deferExecutions.addAll(deferExecutions);
265+
public void setDeferredExecutions(Collection<NormalizedDeferredExecution> deferredExecutions) {
266+
this.deferredExecutions.clear();
267+
this.deferredExecutions.addAll(deferredExecutions);
268268
}
269269

270-
public void addDeferExecutions(Collection<DeferExecution> deferExecutions) {
271-
this.deferExecutions.addAll(deferExecutions);
270+
public void addDeferredExecutions(Collection<NormalizedDeferredExecution> deferredExecutions) {
271+
this.deferredExecutions.addAll(deferredExecutions);
272272
}
273273

274274
/**
@@ -477,12 +477,12 @@ public ExecutableNormalizedField getParent() {
477477
}
478478

479479
/**
480-
* @return the {@link DeferExecution}s associated with this {@link ExecutableNormalizedField}.
481-
* @see DeferExecution
480+
* @return the {@link NormalizedDeferredExecution}s associated with this {@link ExecutableNormalizedField}.
481+
* @see NormalizedDeferredExecution
482482
*/
483483
@ExperimentalApi
484-
public LinkedHashSet<DeferExecution> getDeferExecutions() {
485-
return deferExecutions;
484+
public LinkedHashSet<NormalizedDeferredExecution> getDeferredExecutions() {
485+
return deferredExecutions;
486486
}
487487

488488
@Internal
@@ -612,7 +612,7 @@ public static class Builder {
612612
private LinkedHashMap<String, Object> resolvedArguments = new LinkedHashMap<>();
613613
private ImmutableList<Argument> astArguments = ImmutableKit.emptyList();
614614

615-
private LinkedHashSet<DeferExecution> deferExecutions = new LinkedHashSet<>();
615+
private LinkedHashSet<NormalizedDeferredExecution> deferredExecutions = new LinkedHashSet<>();
616616

617617
private Builder() {
618618
}
@@ -627,7 +627,7 @@ private Builder(ExecutableNormalizedField existing) {
627627
this.children = new ArrayList<>(existing.children);
628628
this.level = existing.getLevel();
629629
this.parent = existing.getParent();
630-
this.deferExecutions = existing.getDeferExecutions();
630+
this.deferredExecutions = existing.getDeferredExecutions();
631631
}
632632

633633
public Builder clearObjectTypesNames() {
@@ -683,8 +683,8 @@ public Builder parent(ExecutableNormalizedField parent) {
683683
return this;
684684
}
685685

686-
public Builder deferExecutions(LinkedHashSet<DeferExecution> deferExecutions) {
687-
this.deferExecutions = deferExecutions;
686+
public Builder deferredExecutions(LinkedHashSet<NormalizedDeferredExecution> deferredExecutions) {
687+
this.deferredExecutions = deferredExecutions;
688688
return this;
689689
}
690690

src/main/java/graphql/normalized/ExecutableNormalizedOperationFactory.java

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import graphql.language.SelectionSet;
3131
import graphql.language.TypeName;
3232
import graphql.language.VariableDefinition;
33-
import graphql.normalized.incremental.DeferExecution;
33+
import graphql.normalized.incremental.NormalizedDeferredExecution;
3434
import graphql.normalized.incremental.IncrementalNodes;
3535
import graphql.schema.FieldCoordinates;
3636
import graphql.schema.GraphQLCompositeType;
@@ -568,7 +568,7 @@ private void createNFs(ImmutableList.Builder<ExecutableNormalizedField> nfListBu
568568
nfListBuilder.add(nf);
569569

570570
if (this.options.deferSupport) {
571-
nf.addDeferExecutions(fieldGroup.deferExecutions);
571+
nf.addDeferredExecutions(fieldGroup.deferredExecutions);
572572
}
573573
}
574574
if (commonParentsGroups.size() > 1) {
@@ -633,22 +633,22 @@ private List<CollectedFieldGroup> groupByCommonParentsNoDeferSupport(Collection<
633633

634634
private List<CollectedFieldGroup> groupByCommonParentsWithDeferSupport(Collection<CollectedField> fields) {
635635
ImmutableSet.Builder<GraphQLObjectType> objectTypes = ImmutableSet.builder();
636-
ImmutableSet.Builder<DeferExecution> deferExecutionsBuilder = ImmutableSet.builder();
636+
ImmutableSet.Builder<NormalizedDeferredExecution> deferredExecutionsBuilder = ImmutableSet.builder();
637637

638638
for (CollectedField collectedField : fields) {
639639
objectTypes.addAll(collectedField.objectTypes);
640640

641-
DeferExecution collectedDeferExecution = collectedField.deferExecution;
641+
NormalizedDeferredExecution collectedDeferredExecution = collectedField.deferredExecution;
642642

643-
if (collectedDeferExecution != null) {
644-
deferExecutionsBuilder.add(collectedDeferExecution);
643+
if (collectedDeferredExecution != null) {
644+
deferredExecutionsBuilder.add(collectedDeferredExecution);
645645
}
646646
}
647647

648648
Set<GraphQLObjectType> allRelevantObjects = objectTypes.build();
649-
Set<DeferExecution> deferExecutions = deferExecutionsBuilder.build();
649+
Set<NormalizedDeferredExecution> deferredExecutions = deferredExecutionsBuilder.build();
650650

651-
Set<String> duplicatedLabels = listDuplicatedLabels(deferExecutions);
651+
Set<String> duplicatedLabels = listDuplicatedLabels(deferredExecutions);
652652

653653
if (!duplicatedLabels.isEmpty()) {
654654
// Query validation should pick this up
@@ -657,33 +657,33 @@ private List<CollectedFieldGroup> groupByCommonParentsWithDeferSupport(Collectio
657657

658658
Map<GraphQLType, ImmutableList<CollectedField>> groupByAstParent = groupingBy(fields, fieldAndType -> fieldAndType.astTypeCondition);
659659
if (groupByAstParent.size() == 1) {
660-
return singletonList(new CollectedFieldGroup(ImmutableSet.copyOf(fields), allRelevantObjects, deferExecutions));
660+
return singletonList(new CollectedFieldGroup(ImmutableSet.copyOf(fields), allRelevantObjects, deferredExecutions));
661661
}
662662

663663
ImmutableList.Builder<CollectedFieldGroup> result = ImmutableList.builder();
664664
for (GraphQLObjectType objectType : allRelevantObjects) {
665665
Set<CollectedField> relevantFields = filterSet(fields, field -> field.objectTypes.contains(objectType));
666666

667-
Set<DeferExecution> filteredDeferExecutions = deferExecutions.stream()
667+
Set<NormalizedDeferredExecution> filteredDeferredExecutions = deferredExecutions.stream()
668668
.filter(filterExecutionsFromType(objectType))
669669
.collect(toCollection(LinkedHashSet::new));
670670

671-
result.add(new CollectedFieldGroup(relevantFields, singleton(objectType), filteredDeferExecutions));
671+
result.add(new CollectedFieldGroup(relevantFields, singleton(objectType), filteredDeferredExecutions));
672672
}
673673
return result.build();
674674
}
675675

676-
private static Predicate<DeferExecution> filterExecutionsFromType(GraphQLObjectType objectType) {
676+
private static Predicate<NormalizedDeferredExecution> filterExecutionsFromType(GraphQLObjectType objectType) {
677677
String objectTypeName = objectType.getName();
678-
return deferExecution -> deferExecution.getPossibleTypes()
678+
return deferredExecution -> deferredExecution.getPossibleTypes()
679679
.stream()
680680
.map(GraphQLObjectType::getName)
681681
.anyMatch(objectTypeName::equals);
682682
}
683683

684-
private Set<String> listDuplicatedLabels(Collection<DeferExecution> deferExecutions) {
685-
return deferExecutions.stream()
686-
.map(DeferExecution::getLabel)
684+
private Set<String> listDuplicatedLabels(Collection<NormalizedDeferredExecution> deferredExecutions) {
685+
return deferredExecutions.stream()
686+
.map(NormalizedDeferredExecution::getLabel)
687687
.filter(Objects::nonNull)
688688
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
689689
.entrySet()
@@ -697,11 +697,11 @@ private void collectFromSelectionSet(SelectionSet selectionSet,
697697
List<CollectedField> result,
698698
GraphQLCompositeType astTypeCondition,
699699
Set<GraphQLObjectType> possibleObjects,
700-
DeferExecution deferExecution
700+
NormalizedDeferredExecution deferredExecution
701701
) {
702702
for (Selection<?> selection : selectionSet.getSelections()) {
703703
if (selection instanceof Field) {
704-
collectField(result, (Field) selection, possibleObjects, astTypeCondition, deferExecution);
704+
collectField(result, (Field) selection, possibleObjects, astTypeCondition, deferredExecution);
705705
} else if (selection instanceof InlineFragment) {
706706
collectInlineFragment(result, (InlineFragment) selection, possibleObjects, astTypeCondition);
707707
} else if (selection instanceof FragmentSpread) {
@@ -731,12 +731,12 @@ private void collectFragmentSpread(List<CollectedField> result,
731731
GraphQLCompositeType newAstTypeCondition = (GraphQLCompositeType) assertNotNull(this.graphQLSchema.getType(fragmentDefinition.getTypeCondition().getName()));
732732
Set<GraphQLObjectType> newPossibleObjects = narrowDownPossibleObjects(possibleObjects, newAstTypeCondition);
733733

734-
DeferExecution newDeferExecution = buildDeferExecution(
734+
NormalizedDeferredExecution newDeferredExecution = buildDeferredExecution(
735735
fragmentSpread.getDirectives(),
736736
fragmentDefinition.getTypeCondition(),
737737
newPossibleObjects);
738738

739-
collectFromSelectionSet(fragmentDefinition.getSelectionSet(), result, newAstTypeCondition, newPossibleObjects, newDeferExecution);
739+
collectFromSelectionSet(fragmentDefinition.getSelectionSet(), result, newAstTypeCondition, newPossibleObjects, newDeferredExecution);
740740
}
741741

742742
private void collectInlineFragment(List<CollectedField> result,
@@ -756,16 +756,16 @@ private void collectInlineFragment(List<CollectedField> result,
756756

757757
}
758758

759-
DeferExecution newDeferExecution = buildDeferExecution(
759+
NormalizedDeferredExecution newDeferredExecution = buildDeferredExecution(
760760
inlineFragment.getDirectives(),
761761
inlineFragment.getTypeCondition(),
762762
newPossibleObjects
763763
);
764764

765-
collectFromSelectionSet(inlineFragment.getSelectionSet(), result, newAstTypeCondition, newPossibleObjects, newDeferExecution);
765+
collectFromSelectionSet(inlineFragment.getSelectionSet(), result, newAstTypeCondition, newPossibleObjects, newDeferredExecution);
766766
}
767767

768-
private DeferExecution buildDeferExecution(
768+
private NormalizedDeferredExecution buildDeferredExecution(
769769
List<Directive> directives,
770770
TypeName typeCondition,
771771
Set<GraphQLObjectType> newPossibleObjects) {
@@ -785,7 +785,7 @@ private void collectField(List<CollectedField> result,
785785
Field field,
786786
Set<GraphQLObjectType> possibleObjectTypes,
787787
GraphQLCompositeType astTypeCondition,
788-
DeferExecution deferExecution
788+
NormalizedDeferredExecution deferredExecution
789789
) {
790790
if (!conditionalNodes.shouldInclude(field,
791791
this.coercedVariableValues.toMap(),
@@ -797,7 +797,7 @@ private void collectField(List<CollectedField> result,
797797
if (possibleObjectTypes.isEmpty()) {
798798
return;
799799
}
800-
result.add(new CollectedField(field, possibleObjectTypes, astTypeCondition, deferExecution));
800+
result.add(new CollectedField(field, possibleObjectTypes, astTypeCondition, deferredExecution));
801801
}
802802

803803
private Set<GraphQLObjectType> narrowDownPossibleObjects(Set<GraphQLObjectType> currentOnes,
@@ -852,13 +852,13 @@ private static class CollectedField {
852852
Field field;
853853
Set<GraphQLObjectType> objectTypes;
854854
GraphQLCompositeType astTypeCondition;
855-
DeferExecution deferExecution;
855+
NormalizedDeferredExecution deferredExecution;
856856

857-
public CollectedField(Field field, Set<GraphQLObjectType> objectTypes, GraphQLCompositeType astTypeCondition, DeferExecution deferExecution) {
857+
public CollectedField(Field field, Set<GraphQLObjectType> objectTypes, GraphQLCompositeType astTypeCondition, NormalizedDeferredExecution deferredExecution) {
858858
this.field = field;
859859
this.objectTypes = objectTypes;
860860
this.astTypeCondition = astTypeCondition;
861-
this.deferExecution = deferExecution;
861+
this.deferredExecution = deferredExecution;
862862
}
863863
}
864864

@@ -885,12 +885,12 @@ private FieldAndAstParent(Field field, GraphQLCompositeType astParentType) {
885885
private static class CollectedFieldGroup {
886886
Set<GraphQLObjectType> objectTypes;
887887
Set<CollectedField> fields;
888-
Set<DeferExecution> deferExecutions;
888+
Set<NormalizedDeferredExecution> deferredExecutions;
889889

890-
public CollectedFieldGroup(Set<CollectedField> fields, Set<GraphQLObjectType> objectTypes, Set<DeferExecution> deferExecutions) {
890+
public CollectedFieldGroup(Set<CollectedField> fields, Set<GraphQLObjectType> objectTypes, Set<NormalizedDeferredExecution> deferredExecutions) {
891891
this.fields = fields;
892892
this.objectTypes = objectTypes;
893-
this.deferExecutions = deferExecutions;
893+
this.deferredExecutions = deferredExecutions;
894894
}
895895
}
896896
}

0 commit comments

Comments
 (0)