@@ -27,7 +27,7 @@ public class FragmentDefinition extends AbstractNode<FragmentDefinition> impleme
2727
2828 private final String name ;
2929 private final TypeName typeCondition ;
30- private final ImmutableList < Directive > directives ;
30+ private final NodeUtil . DirectivesHolder directives ;
3131 private final SelectionSet selectionSet ;
3232
3333 public static final String CHILD_TYPE_CONDITION = "typeCondition" ;
@@ -46,7 +46,7 @@ protected FragmentDefinition(String name,
4646 super (sourceLocation , comments , ignoredChars , additionalData );
4747 this .name = name ;
4848 this .typeCondition = typeCondition ;
49- this .directives = ImmutableList . copyOf (directives );
49+ this .directives = NodeUtil . DirectivesHolder . of (directives );
5050 this .selectionSet = selectionSet ;
5151 }
5252
@@ -62,9 +62,23 @@ public TypeName getTypeCondition() {
6262
6363 @ Override
6464 public List <Directive > getDirectives () {
65- return directives ;
65+ return directives . getDirectives () ;
6666 }
6767
68+ @ Override
69+ public Map <String , List <Directive >> getDirectivesByName () {
70+ return directives .getDirectivesByName ();
71+ }
72+
73+ @ Override
74+ public List <Directive > getDirectives (String directiveName ) {
75+ return directives .getDirectives (directiveName );
76+ }
77+
78+ @ Override
79+ public boolean hasDirective (String directiveName ) {
80+ return directives .hasDirective (directiveName );
81+ }
6882
6983 @ Override
7084 public SelectionSet getSelectionSet () {
@@ -75,7 +89,7 @@ public SelectionSet getSelectionSet() {
7589 public List <Node > getChildren () {
7690 List <Node > result = new ArrayList <>();
7791 result .add (typeCondition );
78- result .addAll (directives );
92+ result .addAll (directives . getDirectives () );
7993 result .add (selectionSet );
8094 return result ;
8195 }
@@ -84,7 +98,7 @@ public List<Node> getChildren() {
8498 public NodeChildrenContainer getNamedChildren () {
8599 return newNodeChildrenContainer ()
86100 .child (CHILD_TYPE_CONDITION , typeCondition )
87- .children (CHILD_DIRECTIVES , directives )
101+ .children (CHILD_DIRECTIVES , directives . getDirectives () )
88102 .child (CHILD_SELECTION_SET , selectionSet )
89103 .build ();
90104 }
@@ -116,7 +130,7 @@ public boolean isEqualTo(Node o) {
116130 public FragmentDefinition deepCopy () {
117131 return new FragmentDefinition (name ,
118132 deepCopy (typeCondition ),
119- deepCopy (directives ),
133+ deepCopy (directives . getDirectives () ),
120134 deepCopy (selectionSet ),
121135 getSourceLocation (),
122136 getComments (),
0 commit comments