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
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description @Nullable String
getAlias()
@Nullable SelectedField
getFirstSubSelectedFieldByName(@NotNull String name)
@Nullable String
getFullyQualifiedName()
int
getLevel()
@Nullable String
getName()
@NotNull List<String>
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@Nullable String
getQualifiedName()
@Nullable String
getResultKey()
The result key is either the field query alias OR the field name in that preference order@Nullable SelectedField
getSubSelectedField(@NotNull String name)
Deprecated.Please use getSubSelectedFieldByName() or getSubSelectedFieldByFQN() instead@Nullable SelectedField
getSubSelectedFieldByFQN(@NotNull String fullyQualifiedName)
@NotNull Collection<SelectedField>
getSubSelectedFieldByName(@NotNull String name)
@NotNull List<SelectedField>
getSubSelectedFields()
boolean
hasDuplicateFieldByName(@NotNull String name)
Checks if there are more than one field with the same nameboolean
hasSubSelectedFields(@NotNull String... name)
Deprecated.Use hasDuplicateFieldByName(), hasSubSelectedFieldsByName() or hasSubSelectedFieldsByFQNboolean
hasSubSelectedFieldsByFQN(@NotNull String... fullyQualifiedName)
boolean
hasSubSelectedFieldsByName(@NotNull String... name)
boolean
isConditional()
boolean
isInline()
Deprecated.There are no more inlined fragments anymore so this is always false
-
-
-
Method Detail
-
getName
@Nullable @Nullable String getName()
- Returns:
- the name as defined in the selection set.
-
getQualifiedName
@Nullable @Nullable String getQualifiedName()
- Returns:
- the simple qualified name of the selected field
-
getFullyQualifiedName
@Nullable @Nullable String 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
@Nullable @Nullable String getAlias()
- Returns:
- the alias of the selected field or null if not alias was used
-
getResultKey
@Nullable @Nullable String 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
@NotNull @NotNull List<SelectedField> 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
@Nullable @Nullable SelectedField getFirstSubSelectedFieldByName(@NotNull @NotNull String name)
- Parameters:
name
- the sub selected field name.- Returns:
- The first field in the map of fields by name if found otherwise null
-
getSubSelectedField
@Deprecated @Nullable @Nullable SelectedField getSubSelectedField(@NotNull @NotNull String name)
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
boolean hasDuplicateFieldByName(@NotNull @NotNull String name)
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
boolean hasSubSelectedFieldsByName(@NotNull @NotNull String... name)
- Parameters:
name
- the sub selected field name(s).- Returns:
- true if any of the sub selected fields exists.
-
hasSubSelectedFieldsByFQN
boolean hasSubSelectedFieldsByFQN(@NotNull @NotNull String... fullyQualifiedName)
-
hasSubSelectedFields
@Deprecated boolean hasSubSelectedFields(@NotNull @NotNull String... name)
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 boolean isInline()
Deprecated.There are no more inlined fragments anymore so this is always false- Returns:
- Always returns false
-
-