Skip to content

Commit a93e127

Browse files
committed
make nodes constructors internal protected
make antlrToLangue converting a bit nicer by pushing null checks down add SDLDefinition to distinguish between SDL definitions and operations
1 parent 67d6257 commit a93e127

45 files changed

Lines changed: 181 additions & 139 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/main/java/graphql/language/Argument.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package graphql.language;
22

33

4+
import graphql.Internal;
45
import graphql.PublicApi;
56
import graphql.util.TraversalControl;
67
import graphql.util.TraverserContext;
@@ -15,7 +16,8 @@ public class Argument extends AbstractNode<Argument> implements NamedNode<Argume
1516
private final String name;
1617
private final Value value;
1718

18-
private Argument(String name, Value value, SourceLocation sourceLocation, List<Comment> comments) {
19+
@Internal
20+
protected Argument(String name, Value value, SourceLocation sourceLocation, List<Comment> comments) {
1921
super(sourceLocation, comments);
2022
this.name = name;
2123
this.value = value;

‎src/main/java/graphql/language/ArrayValue.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package graphql.language;
22

33

4+
import graphql.Internal;
45
import graphql.PublicApi;
56
import graphql.util.TraversalControl;
67
import graphql.util.TraverserContext;
@@ -14,7 +15,8 @@ public class ArrayValue extends AbstractNode<ArrayValue> implements Value<ArrayV
1415

1516
private final List<Value> values = new ArrayList<>();
1617

17-
private ArrayValue(List<Value> values, SourceLocation sourceLocation, List<Comment> comments) {
18+
@Internal
19+
protected ArrayValue(List<Value> values, SourceLocation sourceLocation, List<Comment> comments) {
1820
super(sourceLocation, comments);
1921
this.values.addAll(values);
2022
}

‎src/main/java/graphql/language/BooleanValue.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package graphql.language;
22

33

4+
import graphql.Internal;
45
import graphql.PublicApi;
56
import graphql.util.TraversalControl;
67
import graphql.util.TraverserContext;
@@ -14,7 +15,8 @@ public class BooleanValue extends AbstractNode<BooleanValue> implements Value<Bo
1415

1516
private final boolean value;
1617

17-
private BooleanValue(boolean value, SourceLocation sourceLocation, List<Comment> comments) {
18+
@Internal
19+
protected BooleanValue(boolean value, SourceLocation sourceLocation, List<Comment> comments) {
1820
super(sourceLocation, comments);
1921
this.value = value;
2022
}

‎src/main/java/graphql/language/Directive.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package graphql.language;
22

33

4+
import graphql.Internal;
45
import graphql.PublicApi;
56
import graphql.util.TraversalControl;
67
import graphql.util.TraverserContext;
@@ -17,7 +18,8 @@ public class Directive extends AbstractNode<Directive> implements NamedNode<Dire
1718
private final String name;
1819
private final List<Argument> arguments = new ArrayList<>();
1920

20-
private Directive(String name, List<Argument> arguments, SourceLocation sourceLocation, List<Comment> comments) {
21+
@Internal
22+
protected Directive(String name, List<Argument> arguments, SourceLocation sourceLocation, List<Comment> comments) {
2123
super(sourceLocation, comments);
2224
this.name = name;
2325
this.arguments.addAll(arguments);

‎src/main/java/graphql/language/DirectiveDefinition.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package graphql.language;
22

33

4+
import graphql.Internal;
45
import graphql.PublicApi;
56
import graphql.util.TraversalControl;
67
import graphql.util.TraverserContext;
@@ -10,14 +11,14 @@
1011
import java.util.function.Consumer;
1112

1213
@PublicApi
13-
public class DirectiveDefinition extends AbstractNode<DirectiveDefinition> implements Definition<DirectiveDefinition>, NamedNode<DirectiveDefinition> {
14+
public class DirectiveDefinition extends AbstractNode<DirectiveDefinition> implements SDLDefinition<DirectiveDefinition>, NamedNode<DirectiveDefinition> {
1415
private final String name;
1516
private Description description;
1617
private final List<InputValueDefinition> inputValueDefinitions;
1718
private final List<DirectiveLocation> directiveLocations;
1819

19-
20-
private DirectiveDefinition(String name,
20+
@Internal
21+
protected DirectiveDefinition(String name,
2122
List<InputValueDefinition> inputValueDefinitions,
2223
List<DirectiveLocation> directiveLocations,
2324
SourceLocation sourceLocation,

‎src/main/java/graphql/language/DirectiveLocation.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package graphql.language;
22

33

4+
import graphql.Internal;
45
import graphql.PublicApi;
56
import graphql.util.TraversalControl;
67
import graphql.util.TraverserContext;
@@ -21,7 +22,8 @@
2122
public class DirectiveLocation extends AbstractNode<DirectiveLocation> implements NamedNode<DirectiveLocation> {
2223
private final String name;
2324

24-
private DirectiveLocation(String name, SourceLocation sourceLocation, List<Comment> comments) {
25+
@Internal
26+
protected DirectiveLocation(String name, SourceLocation sourceLocation, List<Comment> comments) {
2527
super(sourceLocation, comments);
2628
this.name = name;
2729
}

‎src/main/java/graphql/language/Document.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package graphql.language;
22

33

4+
import graphql.Internal;
45
import graphql.PublicApi;
56
import graphql.util.TraversalControl;
67
import graphql.util.TraverserContext;
@@ -14,7 +15,8 @@ public class Document extends AbstractNode<Document> {
1415

1516
private final List<Definition> definitions;
1617

17-
private Document(List<Definition> definitions, SourceLocation sourceLocation, List<Comment> comments) {
18+
@Internal
19+
protected Document(List<Definition> definitions, SourceLocation sourceLocation, List<Comment> comments) {
1820
super(sourceLocation, comments);
1921
this.definitions = definitions;
2022
}

‎src/main/java/graphql/language/EnumTypeDefinition.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package graphql.language;
22

3+
import graphql.Internal;
34
import graphql.PublicApi;
45
import graphql.util.TraversalControl;
56
import graphql.util.TraverserContext;
@@ -15,7 +16,8 @@ public class EnumTypeDefinition extends AbstractNode<EnumTypeDefinition> impleme
1516
private final List<EnumValueDefinition> enumValueDefinitions;
1617
private final List<Directive> directives;
1718

18-
EnumTypeDefinition(String name,
19+
@Internal
20+
protected EnumTypeDefinition(String name,
1921
List<EnumValueDefinition> enumValueDefinitions,
2022
List<Directive> directives,
2123
Description description,

‎src/main/java/graphql/language/EnumTypeExtensionDefinition.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package graphql.language;
22

3+
import graphql.Internal;
34
import graphql.PublicApi;
45

56
import java.util.ArrayList;
@@ -9,7 +10,8 @@
910
@PublicApi
1011
public class EnumTypeExtensionDefinition extends EnumTypeDefinition {
1112

12-
private EnumTypeExtensionDefinition(String name,
13+
@Internal
14+
protected EnumTypeExtensionDefinition(String name,
1315
List<EnumValueDefinition> enumValueDefinitions,
1416
List<Directive> directives,
1517
Description description,

‎src/main/java/graphql/language/EnumValue.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package graphql.language;
22

33

4+
import graphql.Internal;
45
import graphql.PublicApi;
56
import graphql.util.TraversalControl;
67
import graphql.util.TraverserContext;
@@ -14,7 +15,8 @@ public class EnumValue extends AbstractNode<EnumValue> implements Value<EnumValu
1415

1516
private final String name;
1617

17-
private EnumValue(String name, SourceLocation sourceLocation, List<Comment> comments) {
18+
@Internal
19+
protected EnumValue(String name, SourceLocation sourceLocation, List<Comment> comments) {
1820
super(sourceLocation, comments);
1921
this.name = name;
2022
}

0 commit comments

Comments
 (0)