Interface GQLSelection
-
- All Known Subinterfaces:
GQLFragment
- All Known Implementing Classes:
GQLField,GQLFragmentDefinition,GQLFragmentReference,GQLInlineFragment,GQLIntrospection,GQLMethodCall,GQLOperation
public interface GQLSelectionWhen defining a graphql each point in a selection set is called a 'selection'. A selection may be a field or a fragment, each having a distinct definition and uses. Most selections can be recursive, i.e. containing a selection set of it's own. The selection set is ordered, therefore it is returned as a list, not a set.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.List<GQLSelection>getSelection(net.morimekta.providence.descriptor.PField field)Get all selection entries related to the given field.java.util.List<GQLSelection>getSelectionSet()default booleanhasSelection(net.morimekta.providence.descriptor.PField... fields)Check if any of the given fields are in the selection.
-
-
-
Method Detail
-
getSelectionSet
@Nullable java.util.List<GQLSelection> getSelectionSet()
- Returns:
- List if selections contained within this selection.
-
hasSelection
default boolean hasSelection(@Nonnull net.morimekta.providence.descriptor.PField... fields)Check if any of the given fields are in the selection. It will only look the the current struct, but check in all contained and referenced fragments. If only one field is given, this method will return true if and only ifgetSelection(PField)returns a non-empty list.- Parameters:
fields- Fields to check selection for.- Returns:
- True only if the current selection set contains ony of the provided fields.
-
getSelection
@Nonnull default java.util.List<GQLSelection> getSelection(@Nonnull net.morimekta.providence.descriptor.PField field)
Get all selection entries related to the given field. It will only look at the current struct, but look at all levels of fragments. The result will contain one entry for each time the field is requested, so if multiple fragments requests the same field, this will return one entry per reference. If it contains more than one, the query should only have one such without alias, and all others should use unique aliases, but is not required. This method will return a non-empty list if and only ifhasSelection(PField[])called with the same field returns true.- Parameters:
field- The field to get selection for.- Returns:
- List of selection related to the field.
-
-