Package org.apache.sling.graphql.api
Interface SelectedField
@ProviderType
public interface SelectedField
Interface to wrap information from GraphQL SelectedField.
As described in SelectionSet, it is aimed to map the SelectedField to the minimum information
required when processing the query.
InlineFragment are mapped so that its isInline() is return true.
-
Method Summary
Modifier and TypeMethodDescription@Nullable StringgetAlias()@Nullable SelectedFieldgetFirstSubSelectedFieldByName(@NotNull String name) @Nullable StringintgetLevel()@Nullable StringgetName()The Object Type Name is taken from the Normalized Field from GraphQL Java and denotes any inlined fragment type that field can be part of@Nullable String@Nullable StringThe result key is either the field query alias OR the field name in that preference order@Nullable SelectedFieldgetSubSelectedField(@NotNull String name) Deprecated.Please use getSubSelectedFieldByName() or getSubSelectedFieldByFQN() instead@Nullable SelectedFieldgetSubSelectedFieldByFQN(@NotNull String fullyQualifiedName) @NotNull Collection<SelectedField>getSubSelectedFieldByName(@NotNull String name) @NotNull List<SelectedField>booleanhasDuplicateFieldByName(@NotNull String name) Checks if there are more than one field with the same namebooleanhasSubSelectedFields(@NotNull String... name) Deprecated.Use hasDuplicateFieldByName(), hasSubSelectedFieldsByName() or hasSubSelectedFieldsByFQNbooleanhasSubSelectedFieldsByFQN(@NotNull String... fullyQualifiedName) booleanhasSubSelectedFieldsByName(@NotNull String... name) booleanbooleanisInline()Deprecated.There are no more inlined fragments anymore so this is always false
-
Method Details
-
getName
- Returns:
- the name as defined in the selection set.
-
getQualifiedName
- Returns:
- the simple qualified name of the selected field
-
getFullyQualifiedName
- Returns:
- the fully qualified name of the item
-
getLevel
int getLevel()- Returns:
- level of the selected field within the query
-
isConditional
boolean isConditional()- Returns:
- whether the field is conditionally present
-
getAlias
- Returns:
- the alias of the selected field or null if not alias was used
-
getResultKey
The result key is either the field query alias OR the field name in that preference order- Returns:
- the result key of the selected field
-
getSubSelectedFields
- Returns:
- the sub selected fields.
-
getSubSelectedFieldByName
@NotNull @NotNull Collection<SelectedField> getSubSelectedFieldByName(@NotNull @NotNull String name) - Parameters:
name- the sub selected field name.- Returns:
- A collection of selected fields or an empty collection if not found
-
getFirstSubSelectedFieldByName
- Parameters:
name- the sub selected field name.- Returns:
- The first field in the map of fields by name if found otherwise null
-
getSubSelectedField
Deprecated.Please use getSubSelectedFieldByName() or getSubSelectedFieldByFQN() instead- Parameters:
name- the sub selected field name. Note: If the name contains a dot it is looked up in the map of fully qualified names otherwise from the map with the regular names- Returns:
- the object or null if that doesn't exist.
-
getSubSelectedFieldByFQN
@Nullable @Nullable SelectedField getSubSelectedFieldByFQN(@NotNull @NotNull String fullyQualifiedName) - Parameters:
fullyQualifiedName- the sub selected field name.- Returns:
- the object or null if that doesn't exist.
-
hasDuplicateFieldByName
Checks if there are more than one field with the same name- Parameters:
name- Simple Name of a Field to look for- Returns:
- True if a field exists with that and contains more than one field
-
hasSubSelectedFieldsByName
- Parameters:
name- the sub selected field name(s).- Returns:
- true if any of the sub selected fields exists.
-
hasSubSelectedFieldsByFQN
-
hasSubSelectedFields
Deprecated.Use hasDuplicateFieldByName(), hasSubSelectedFieldsByName() or hasSubSelectedFieldsByFQN- Parameters:
name- the sub selected field name(s) and they cannot be null Note: If the name contains a dot it is looked up in the map of fully qualified names otherwise from the map with the regular names- Returns:
- true if any of the sub selected fields exists.
-
isInline
Deprecated.There are no more inlined fragments anymore so this is always false- Returns:
- Always returns false
-
getObjectTypeNames
The Object Type Name is taken from the Normalized Field from GraphQL Java and denotes any inlined fragment type that field can be part of- Returns:
- List of Object Type Names which is always a List but might be empty
-