1717import static java .util .Collections .emptyMap ;
1818
1919@ PublicApi
20- public class InterfaceTypeDefinition extends AbstractDescribedNode <InterfaceTypeDefinition > implements TypeDefinition <InterfaceTypeDefinition >, DirectivesContainer <InterfaceTypeDefinition >, NamedNode <InterfaceTypeDefinition > {
20+ public class InterfaceTypeDefinition extends AbstractDescribedNode <InterfaceTypeDefinition > implements ImplementingTypeDefinition <InterfaceTypeDefinition >, DirectivesContainer <InterfaceTypeDefinition >, NamedNode <InterfaceTypeDefinition > {
2121
2222 private final String name ;
23+ private final List <Type > implementz ;
2324 private final List <FieldDefinition > definitions ;
2425 private final List <Directive > directives ;
2526
27+ public static final String CHILD_IMPLEMENTZ = "implementz" ;
2628 public static final String CHILD_DEFINITIONS = "definitions" ;
2729 public static final String CHILD_DIRECTIVES = "directives" ;
2830
2931 @ Internal
3032 protected InterfaceTypeDefinition (String name ,
33+ List <Type > implementz ,
3134 List <FieldDefinition > definitions ,
3235 List <Directive > directives ,
3336 Description description ,
@@ -37,6 +40,7 @@ protected InterfaceTypeDefinition(String name,
3740 Map <String , String > additionalData ) {
3841 super (sourceLocation , comments , ignoredChars , additionalData , description );
3942 this .name = name ;
43+ this .implementz = implementz ;
4044 this .definitions = definitions ;
4145 this .directives = directives ;
4246 }
@@ -47,9 +51,15 @@ protected InterfaceTypeDefinition(String name,
4751 * @param name of the interface
4852 */
4953 public InterfaceTypeDefinition (String name ) {
50- this (name , new ArrayList <>(), new ArrayList <>(), null , null , new ArrayList <>(), IgnoredChars .EMPTY , emptyMap ());
54+ this (name , new ArrayList <>(), new ArrayList <>(), new ArrayList <>(), null , null , new ArrayList <>(), IgnoredChars .EMPTY , emptyMap ());
5155 }
5256
57+ @ Override
58+ public List <Type > getImplements () {
59+ return new ArrayList <>(implementz );
60+ }
61+
62+ @ Override
5363 public List <FieldDefinition > getFieldDefinitions () {
5464 return new ArrayList <>(definitions );
5565 }
@@ -67,6 +77,7 @@ public String getName() {
6777 @ Override
6878 public List <Node > getChildren () {
6979 List <Node > result = new ArrayList <>();
80+ result .addAll (implementz );
7081 result .addAll (definitions );
7182 result .addAll (directives );
7283 return result ;
@@ -75,6 +86,7 @@ public List<Node> getChildren() {
7586 @ Override
7687 public NodeChildrenContainer getNamedChildren () {
7788 return newNodeChildrenContainer ()
89+ .children (CHILD_IMPLEMENTZ , implementz )
7890 .children (CHILD_DEFINITIONS , definitions )
7991 .children (CHILD_DIRECTIVES , directives )
8092 .build ();
@@ -83,6 +95,7 @@ public NodeChildrenContainer getNamedChildren() {
8395 @ Override
8496 public InterfaceTypeDefinition withNewChildren (NodeChildrenContainer newChildren ) {
8597 return transform (builder -> builder
98+ .implementz (newChildren .getChildren (CHILD_IMPLEMENTZ ))
8699 .definitions (newChildren .getChildren (CHILD_DEFINITIONS ))
87100 .directives (newChildren .getChildren (CHILD_DIRECTIVES ))
88101 );
@@ -105,6 +118,7 @@ public boolean isEqualTo(Node o) {
105118 @ Override
106119 public InterfaceTypeDefinition deepCopy () {
107120 return new InterfaceTypeDefinition (name ,
121+ deepCopy (implementz ),
108122 deepCopy (definitions ),
109123 deepCopy (directives ),
110124 description ,
@@ -118,6 +132,7 @@ public InterfaceTypeDefinition deepCopy() {
118132 public String toString () {
119133 return "InterfaceTypeDefinition{" +
120134 "name='" + name + '\'' +
135+ ", implements=" + implementz +
121136 ", fieldDefinitions=" + definitions +
122137 ", directives=" + directives +
123138 '}' ;
@@ -144,6 +159,7 @@ public static final class Builder implements NodeBuilder {
144159 private List <Comment > comments = new ArrayList <>();
145160 private String name ;
146161 private Description description ;
162+ private List <Type > implementz = new ArrayList <>();
147163 private List <FieldDefinition > definitions = new ArrayList <>();
148164 private List <Directive > directives = new ArrayList <>();
149165 private IgnoredChars ignoredChars = IgnoredChars .EMPTY ;
@@ -185,6 +201,17 @@ public Builder description(Description description) {
185201 return this ;
186202 }
187203
204+ public Builder implementz (List <Type > implementz ) {
205+ this .implementz = implementz ;
206+ return this ;
207+ }
208+
209+ public Builder implementz (Type implement ) {
210+ this .implementz .add (implement );
211+ return this ;
212+ }
213+
214+
188215 public Builder definitions (List <FieldDefinition > definitions ) {
189216 this .definitions = definitions ;
190217 return this ;
@@ -223,6 +250,7 @@ public Builder additionalData(String key, String value) {
223250
224251 public InterfaceTypeDefinition build () {
225252 return new InterfaceTypeDefinition (name ,
253+ implementz ,
226254 definitions ,
227255 directives ,
228256 description ,
0 commit comments