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:query Foo { bar ...BarFragment } fragment BarFragment on Query { bar }
{ me{fistName} me{lastName} }
{ foo @someDirective foo @anotherDirective }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MergedField.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(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.String
getName()
All merged fields have the same name.java.lang.String
getResultKey()
Returns the key of this MergedField for the overall result.Field
getSingleField()
The first of the merged fields.int
hashCode()
static MergedField.Builder
newMergedField()
static MergedField.Builder
newMergedField(Field field)
static MergedField.Builder
newMergedField(java.util.List<Field> fields)
java.lang.String
toString()
MergedField
transform(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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-