Interface GQLFragment
-
- All Superinterfaces:
GQLSelection
- All Known Implementing Classes:
GQLFragmentDefinition,GQLFragmentReference,GQLInlineFragment
public interface GQLFragment extends GQLSelection
A fragment is a piece of a field list representing a single type as part of a struct, union, union list, interface list etc. E.g. consider the graphql type structure:
And the query document:interface Character { name: String! appears_in: [Movie!]! } type Human implements Character { height: Float! } type Droid implements Character { purpose: String! } union CharacterUnion = Human | Droid type Query { hero: CharacterUnion }
Here{ hero { name ... on Droid { purpose } ... HumanFields } } fragment HumanFields on Human { height }...of Droidis an inline fragment, andHumanFieldsis a fragment reference and definition.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.List<GQLSelection>getSelectionSet()net.morimekta.providence.descriptor.PMessageDescriptor<?>getTypeCondition()All fragments represent a specific message type of a union field, or an interface implementation.default booleanisApplicableFor(net.morimekta.providence.descriptor.PMessageDescriptor containingType)-
Methods inherited from interface net.morimekta.providence.graphql.gql.GQLSelection
getSelection, hasSelection
-
-
-
-
Method Detail
-
getTypeCondition
@Nonnull net.morimekta.providence.descriptor.PMessageDescriptor<?> getTypeCondition()
All fragments represent a specific message type of a union field, or an interface implementation. This should return the descriptor of that message type.- Returns:
- The fragment type descriptor.
-
getSelectionSet
@Nonnull java.util.List<GQLSelection> getSelectionSet()
- Specified by:
getSelectionSetin interfaceGQLSelection- Returns:
- List if selections contained within this selection.
-
isApplicableFor
default boolean isApplicableFor(net.morimekta.providence.descriptor.PMessageDescriptor containingType)
- Parameters:
containingType- Containing type to check.- Returns:
- True if the fragment should be applied when writing content for the containing message type.
-
-