Package graphql.schema
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 haveGraphQLAppliedDirective
s.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 ofGraphQLAppliedDirective
. AGraphQLDirective
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.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CHILD_APPLIED_DIRECTIVES
static java.lang.String
CHILD_DIRECTIVES
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.util.List<GraphQLAppliedDirective>>
getAllAppliedDirectivesByName()
This will return a Map of the all directives that are associated with aGraphQLNamedSchemaElement
, including both repeatable and non-repeatable directives.java.util.Map<java.lang.String,java.util.List<GraphQLDirective>>
getAllDirectivesByName()
Deprecated.- use theGraphQLAppliedDirective
methods insteadGraphQLAppliedDirective
getAppliedDirective(java.lang.String directiveName)
Returns a non-repeatable directive with the provided name.java.util.List<GraphQLAppliedDirective>
getAppliedDirectives()
This will return a list of all the directives that have been put onGraphQLNamedSchemaElement
as a flat list, which may contain repeatable and non-repeatable directives.default java.util.List<GraphQLAppliedDirective>
getAppliedDirectives(java.lang.String directiveName)
Returns all of the directives with the provided name, including repeatable and non repeatable directives.GraphQLDirective
getDirective(java.lang.String directiveName)
Deprecated.- use theGraphQLAppliedDirective
methods insteadjava.util.List<GraphQLDirective>
getDirectives()
Deprecated.- use theGraphQLAppliedDirective
methods insteaddefault java.util.List<GraphQLDirective>
getDirectives(java.lang.String directiveName)
Deprecated.- use theGraphQLAppliedDirective
methods insteadjava.util.Map<java.lang.String,GraphQLDirective>
getDirectivesByName()
Deprecated.- use theGraphQLAppliedDirective
methods insteaddefault boolean
hasAppliedDirective(java.lang.String directiveName)
This will return true if the element has a directive (repeatable or non repeatable) with the specified namedefault boolean
hasDirective(java.lang.String directiveName)
Deprecated.usehasAppliedDirective(String)
instead-
Methods inherited from interface graphql.schema.GraphQLNamedSchemaElement
getDefinition, getDescription, getName
-
Methods inherited from interface graphql.schema.GraphQLSchemaElement
accept, copy, equals, getChildren, getChildrenWithTypeReferences, hashCode, withNewChildren
-
-
-
-
Field Detail
-
CHILD_DIRECTIVES
static final java.lang.String CHILD_DIRECTIVES
- See Also:
- Constant Field Values
-
CHILD_APPLIED_DIRECTIVES
static final java.lang.String CHILD_APPLIED_DIRECTIVES
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAppliedDirectives
java.util.List<GraphQLAppliedDirective> getAppliedDirectives()
This will return a list of all the directives that have been put onGraphQLNamedSchemaElement
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
java.util.Map<java.lang.String,java.util.List<GraphQLAppliedDirective>> getAllAppliedDirectivesByName()
This will return a Map of the all directives that are associated with aGraphQLNamedSchemaElement
, including both repeatable and non-repeatable directives.- Returns:
- a map of all directives by directive name
-
getAppliedDirective
GraphQLAppliedDirective getAppliedDirective(java.lang.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 java.util.List<GraphQLAppliedDirective> getAppliedDirectives(java.lang.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 default boolean hasDirective(java.lang.String directiveName)
Deprecated.usehasAppliedDirective(String)
insteadThis 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(java.lang.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 java.util.List<GraphQLDirective> getDirectives()
Deprecated.- use theGraphQLAppliedDirective
methods insteadThis will return a list of all the directives that have been put onGraphQLNamedSchemaElement
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 java.util.Map<java.lang.String,GraphQLDirective> getDirectivesByName()
Deprecated.- use theGraphQLAppliedDirective
methods insteadThis will return a Map of the non repeatable directives that are associated with aGraphQLNamedSchemaElement
. Any repeatable directives will be filtered out of this map.- Returns:
- a map of non repeatable directives by directive name.
-
getAllDirectivesByName
@Deprecated java.util.Map<java.lang.String,java.util.List<GraphQLDirective>> getAllDirectivesByName()
Deprecated.- use theGraphQLAppliedDirective
methods insteadThis will return a Map of the all directives that are associated with aGraphQLNamedSchemaElement
, including both repeatable and non repeatable directives.- Returns:
- a map of all directives by directive name
-
getDirective
@Deprecated GraphQLDirective getDirective(java.lang.String directiveName)
Deprecated.- use theGraphQLAppliedDirective
methods insteadReturns a non-repeatable directive with the provided name. This will throw aAssertException
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 default java.util.List<GraphQLDirective> getDirectives(java.lang.String directiveName)
Deprecated.- use theGraphQLAppliedDirective
methods insteadReturns 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
-
-