Interface GraphQLDirectiveContainer

All Superinterfaces:
GraphQLNamedSchemaElement, GraphQLSchemaElement
All Known Subinterfaces:
GraphQLInputValueDefinition
All Known Implementing Classes:
GraphQLArgument, GraphQLEnumType, GraphQLEnumValueDefinition, GraphQLFieldDefinition, GraphQLInputObjectField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLScalarType, GraphQLUnionType

@PublicApi public interface GraphQLDirectiveContainer extends GraphQLNamedSchemaElement
Represents a graphql runtime type that can have GraphQLAppliedDirectives.

Directives can be repeatable and (by default) non-repeatable.

There are access methods here that get the two different types.

The use of GraphQLDirective to represent a directive applied to an element is deprecated in favour of GraphQLAppliedDirective. A GraphQLDirective really should represent the definition of a directive in a schema, not its use on schema elements. However, it has been left in place for legacy reasons and will be removed in a future version.

See Also:
  • Field Details

  • Method Details

    • getAppliedDirectives

      List<GraphQLAppliedDirective> getAppliedDirectives()
      This will return a list of all the directives that have been put on GraphQLNamedSchemaElement as a flat list, which may contain repeatable and non-repeatable directives.
      Returns:
      a list of all the directives associated with this named schema element
    • getAllAppliedDirectivesByName

      Map<String,List<GraphQLAppliedDirective>> getAllAppliedDirectivesByName()
      This will return a Map of the all directives that are associated with a GraphQLNamedSchemaElement, including both repeatable and non-repeatable directives.
      Returns:
      a map of all directives by directive name
    • getAppliedDirective

      GraphQLAppliedDirective getAppliedDirective(String directiveName)
      Returns a non-repeatable directive with the provided name.
      Parameters:
      directiveName - the name of the directive to retrieve
      Returns:
      the directive or null if there is not one with that name
    • getAppliedDirectives

      default List<GraphQLAppliedDirective> getAppliedDirectives(String directiveName)
      Returns all of the directives with the provided name, including repeatable and non repeatable directives.
      Parameters:
      directiveName - the name of the directives to retrieve
      Returns:
      the directives or empty list if there is not one with that name
    • hasDirective

      @Deprecated(since="2022-02-24") default boolean hasDirective(String directiveName)
      Deprecated.
      This will return true if the element has a directive (repeatable or non repeatable) with the specified name
      Parameters:
      directiveName - the name of the directive
      Returns:
      true if there is a directive on this element with that name
    • hasAppliedDirective

      default boolean hasAppliedDirective(String directiveName)
      This will return true if the element has a directive (repeatable or non repeatable) with the specified name
      Parameters:
      directiveName - the name of the directive
      Returns:
      true if there is a directive on this element with that name
    • getDirectives

      @Deprecated(since="2022-02-24") List<GraphQLDirective> getDirectives()
      Deprecated.
      - use the GraphQLAppliedDirective methods instead
      This will return a list of all the directives that have been put on GraphQLNamedSchemaElement as a flat list, which may contain repeatable and non-repeatable directives.
      Returns:
      a list of all the directives associated with this named schema element
    • getDirectivesByName

      @Deprecated(since="2022-02-24") Map<String,GraphQLDirective> getDirectivesByName()
      Deprecated.
      - use the GraphQLAppliedDirective methods instead
      This will return a Map of the non repeatable directives that are associated with a GraphQLNamedSchemaElement. Any repeatable directives will be filtered out of this map.
      Returns:
      a map of non repeatable directives by directive name.
    • getAllDirectivesByName

      @Deprecated(since="2022-02-24") Map<String,List<GraphQLDirective>> getAllDirectivesByName()
      Deprecated.
      - use the GraphQLAppliedDirective methods instead
      This will return a Map of the all directives that are associated with a GraphQLNamedSchemaElement, including both repeatable and non repeatable directives.
      Returns:
      a map of all directives by directive name
    • getDirective

      @Deprecated(since="2022-02-24") GraphQLDirective getDirective(String directiveName)
      Deprecated.
      - use the GraphQLAppliedDirective methods instead
      Returns a non-repeatable directive with the provided name. This will throw a AssertException if the directive is a repeatable directive that has more then one instance.
      Parameters:
      directiveName - the name of the directive to retrieve
      Returns:
      the directive or null if there is not one with that name
    • getDirectives

      @Deprecated(since="2022-02-24") default List<GraphQLDirective> getDirectives(String directiveName)
      Deprecated.
      - use the GraphQLAppliedDirective methods instead
      Returns all of the directives with the provided name, including repeatable and non repeatable directives.
      Parameters:
      directiveName - the name of the directives to retrieve
      Returns:
      the directives or empty list if there is not one with that name