Package graphql.execution
Class MergedField
- java.lang.Object
-
- graphql.execution.MergedField
-
@PublicApi public class MergedField extends java.lang.Object
This represents all Fields in a query which overlap and are merged into one. This means they all represent the same field actually when the query is executed. Example query with more than one Field merged together:
Another example:query Foo { bar ...BarFragment } fragment BarFragment on Query { bar }
Here the field is merged together including the sub selections. A third example with different directives:{ me{fistName} me{lastName} }
These examples make clear that you need to consider all merged fields together to have the full picture. The actual logic when fields can be successfully merged together is implemented in {#graphql.validation.rules.OverlappingFieldsCanBeMerged}{ foo @someDirective foo @anotherDirective }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMergedField.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.util.List<Argument>getArguments()All merged fields share the same arguments.java.util.List<Field>getFields()All merged fieldsjava.lang.StringgetName()All merged fields have the same name.java.lang.StringgetResultKey()Returns the key of this MergedField for the overall result.FieldgetSingleField()The first of the merged fields.inthashCode()static MergedField.BuildernewMergedField()static MergedField.BuildernewMergedField(Field field)static MergedField.BuildernewMergedField(java.util.List<Field> fields)java.lang.StringtoString()MergedFieldtransform(java.util.function.Consumer<MergedField.Builder> builderConsumer)
-
-
-
Method Detail
-
getName
public java.lang.String getName()
All merged fields have the same name. WARNING: This is not always the key in the execution result, because of possible aliases. SeegetResultKey()- Returns:
- the name of the merged fields.
-
getResultKey
public java.lang.String getResultKey()
Returns the key of this MergedField for the overall result. This is either an alias or the field name.- Returns:
- the key for this MergedField.
-
getSingleField
public Field getSingleField()
The first of the merged fields. Because all fields are almost identically often only one of the merged fields are used.- Returns:
- the fist of the merged Fields
-
getArguments
public java.util.List<Argument> getArguments()
All merged fields share the same arguments.- Returns:
- the list of arguments
-
getFields
public java.util.List<Field> getFields()
All merged fields- Returns:
- all merged fields
-
newMergedField
public static MergedField.Builder newMergedField()
-
newMergedField
public static MergedField.Builder newMergedField(Field field)
-
newMergedField
public static MergedField.Builder newMergedField(java.util.List<Field> fields)
-
transform
public MergedField transform(java.util.function.Consumer<MergedField.Builder> builderConsumer)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-