Package graphql.execution
Class MergedField
java.lang.Object
graphql.execution.MergedField
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:
query Foo {
bar
...BarFragment
}
fragment BarFragment on Query {
bar
}
Another example:
{
me{fistName}
me{lastName}
}
Here the field is merged together including the sub selections.
A third example with different directives:
{
foo @someDirective
foo @anotherDirective
}
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}-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
MergedField
(com.google.common.collect.ImmutableList<Field> fields) -
Method Summary
Modifier and TypeMethodDescriptionboolean
All merged fields share the same arguments.All merged fieldsgetName()
All merged fields have the same name.Returns the key of this MergedField for the overall result.The first of the merged fields.int
hashCode()
static MergedField.Builder
static MergedField.Builder
newMergedField
(Field field) static MergedField.Builder
newMergedField
(List<Field> fields) toString()
transform
(Consumer<MergedField.Builder> builderConsumer)
-
Field Details
-
fields
-
singleField
-
-
Constructor Details
-
MergedField
-
-
Method Details
-
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
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
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
All merged fields share the same arguments.- Returns:
- the list of arguments
-
getFields
All merged fields- Returns:
- all merged fields
-
newMergedField
-
newMergedField
-
newMergedField
-
transform
-
equals
-
hashCode
public int hashCode() -
toString
-