@PublicApi public class GraphQLSchema extends java.lang.Object
See http://graphql.org/learn/schema/#type-language for more details
Modifier and Type | Class and Description |
---|---|
static class |
GraphQLSchema.Builder |
static class |
GraphQLSchema.BuilderWithoutTypes |
Constructor and Description |
---|
GraphQLSchema(GraphQLSchema.BuilderWithoutTypes builder) |
GraphQLSchema(GraphQLSchema existingSchema,
GraphQLCodeRegistry codeRegistry,
com.google.common.collect.ImmutableMap<java.lang.String,GraphQLNamedType> typeMap,
com.google.common.collect.ImmutableMap<java.lang.String,com.google.common.collect.ImmutableList<GraphQLObjectType>> interfaceNameToObjectTypes) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsType(java.lang.String typeName)
Returns true if the schema contains a type with the specified name
|
java.util.Set<GraphQLType> |
getAdditionalTypes() |
java.util.List<GraphQLNamedSchemaElement> |
getAllElementsAsList()
This returns all the top level
GraphQLNamedSchemaElement named types and directives
in the schema |
java.util.Map<java.lang.String,java.util.List<GraphQLAppliedDirective>> |
getAllSchemaAppliedDirectivesByName()
This returns a map of non-repeatable and repeatable directives that have been explicitly applied to the
schema object.
|
java.util.Map<java.lang.String,java.util.List<GraphQLDirective>> |
getAllSchemaDirectivesByName()
Deprecated.
Use the
GraphQLAppliedDirective methods instead |
java.util.List<GraphQLNamedType> |
getAllTypesAsList()
This returns all the
GraphQLNamedType named types in th schema |
GraphQLCodeRegistry |
getCodeRegistry() |
@Nullable SchemaDefinition |
getDefinition() |
@Nullable java.lang.String |
getDescription() |
GraphQLDirective |
getDirective(java.lang.String directiveName)
Returns a named directive that (for legacy reasons) will be only in the set of non repeatable directives
|
java.util.List<GraphQLDirective> |
getDirectives()
This returns the list of directives definitions that are associated with this schema object including
built in ones.
|
java.util.Map<java.lang.String,GraphQLDirective> |
getDirectivesByName() |
java.util.List<SchemaExtensionDefinition> |
getExtensionDefinitions() |
GraphQLFieldDefinition |
getFieldDefinition(FieldCoordinates fieldCoordinates)
Returns a
GraphQLFieldDefinition as the specified co-ordinates or null
if it does not exist |
GraphqlFieldVisibility |
getFieldVisibility()
Deprecated.
use
GraphQLCodeRegistry.getFieldVisibility() instead |
java.util.List<GraphQLObjectType> |
getImplementations(GraphQLInterfaceType type)
This will return the list of
GraphQLObjectType types that implement the given
interface type. |
GraphQLFieldDefinition |
getIntrospectionSchemaFieldDefinition() |
GraphQLObjectType |
getIntrospectionSchemaType() |
GraphQLFieldDefinition |
getIntrospectionTypeFieldDefinition() |
GraphQLFieldDefinition |
getIntrospectionTypenameFieldDefinition() |
GraphQLObjectType |
getMutationType() |
GraphQLObjectType |
getObjectType(java.lang.String typeName)
Called to return a named
GraphQLObjectType from the schema |
GraphQLObjectType |
getQueryType() |
GraphQLAppliedDirective |
getSchemaAppliedDirective(java.lang.String directiveName)
This returns the named directive that have been explicitly applied to the
schema object.
|
java.util.List<GraphQLAppliedDirective> |
getSchemaAppliedDirectives()
This returns the list of directives that have been explicitly applied to the
schema object.
|
java.util.List<GraphQLAppliedDirective> |
getSchemaAppliedDirectives(java.lang.String directiveName) |
GraphQLDirective |
getSchemaDirective(java.lang.String directiveName)
Deprecated.
Use the
GraphQLAppliedDirective methods instead |
java.util.Map<java.lang.String,GraphQLDirective> |
getSchemaDirectiveByName()
Deprecated.
Use the
GraphQLAppliedDirective methods instead |
java.util.List<GraphQLDirective> |
getSchemaDirectives()
Deprecated.
Use the
GraphQLAppliedDirective methods instead |
java.util.List<GraphQLDirective> |
getSchemaDirectives(java.lang.String directiveName)
Deprecated.
Use the
GraphQLAppliedDirective methods instead |
GraphQLObjectType |
getSubscriptionType() |
@Nullable GraphQLType |
getType(@NotNull java.lang.String typeName)
Gets the named type from the schema or null if it's not present
|
<T extends GraphQLType> |
getTypeAs(java.lang.String typeName)
Gets the named type from the schema or null if it's not present.
|
java.util.Map<java.lang.String,GraphQLNamedType> |
getTypeMap() |
<T extends GraphQLType> |
getTypes(java.util.Collection<java.lang.String> typeNames)
All types with the provided names.
|
boolean |
isPossibleType(GraphQLNamedType abstractType,
GraphQLObjectType concreteType)
Returns true if a specified concrete type is a possible type of a provided abstract type.
|
boolean |
isSupportingMutations() |
boolean |
isSupportingSubscriptions() |
static GraphQLSchema.Builder |
newSchema() |
static GraphQLSchema.Builder |
newSchema(GraphQLSchema existingSchema)
This allows you to build a schema from an existing schema.
|
GraphQLSchema |
transform(java.util.function.Consumer<GraphQLSchema.Builder> builderConsumer)
This helps you transform the current GraphQLSchema object into another one by starting a builder with all
the current values and allows you to transform it how you want.
|
GraphQLSchema |
transformWithoutTypes(java.util.function.Consumer<GraphQLSchema.BuilderWithoutTypes> builderConsumer)
This helps you transform the current GraphQLSchema object into another one by using a builder that only allows you to change
simple values and does not involve changing the complex schema type graph.
|
public GraphQLSchema(GraphQLSchema existingSchema, GraphQLCodeRegistry codeRegistry, com.google.common.collect.ImmutableMap<java.lang.String,GraphQLNamedType> typeMap, com.google.common.collect.ImmutableMap<java.lang.String,com.google.common.collect.ImmutableList<GraphQLObjectType>> interfaceNameToObjectTypes)
public GraphQLSchema(GraphQLSchema.BuilderWithoutTypes builder)
public GraphQLCodeRegistry getCodeRegistry()
public GraphQLFieldDefinition getIntrospectionSchemaFieldDefinition()
public GraphQLFieldDefinition getIntrospectionTypeFieldDefinition()
public GraphQLFieldDefinition getIntrospectionTypenameFieldDefinition()
public GraphQLObjectType getIntrospectionSchemaType()
public java.util.Set<GraphQLType> getAdditionalTypes()
@Nullable public @Nullable GraphQLType getType(@NotNull @NotNull java.lang.String typeName)
typeName
- the name of the type to retrievepublic <T extends GraphQLType> java.util.List<T> getTypes(java.util.Collection<java.lang.String> typeNames)
AssertException
when a type name could not be resolvedT
- for twotypeNames
- the type names to getpublic <T extends GraphQLType> T getTypeAs(java.lang.String typeName)
T
- for twotypeName
- the name of the type to retrievepublic boolean containsType(java.lang.String typeName)
typeName
- the name of the type to checkpublic GraphQLObjectType getObjectType(java.lang.String typeName)
GraphQLObjectType
from the schematypeName
- the name of the typeGraphQLException
- if the type is NOT a object typepublic GraphQLFieldDefinition getFieldDefinition(FieldCoordinates fieldCoordinates)
GraphQLFieldDefinition
as the specified co-ordinates or null
if it does not existfieldCoordinates
- the field co-ordinatespublic java.util.Map<java.lang.String,GraphQLNamedType> getTypeMap()
public java.util.List<GraphQLNamedType> getAllTypesAsList()
GraphQLNamedType
named types in th schemaGraphQLNamedType
types in the schemapublic java.util.List<GraphQLNamedSchemaElement> getAllElementsAsList()
GraphQLNamedSchemaElement
named types and directives
in the schemaGraphQLNamedSchemaElement
types and directives in the schemapublic java.util.List<GraphQLObjectType> getImplementations(GraphQLInterfaceType type)
GraphQLObjectType
types that implement the given
interface type.type
- interface type to obtain implementations of.public boolean isPossibleType(GraphQLNamedType abstractType, GraphQLObjectType concreteType)
abstractType
- abstract type either interface or unionconcreteType
- concrete typepublic GraphQLObjectType getQueryType()
public GraphQLObjectType getMutationType()
public GraphQLObjectType getSubscriptionType()
@Deprecated public GraphqlFieldVisibility getFieldVisibility()
GraphQLCodeRegistry.getFieldVisibility()
insteadpublic java.util.List<GraphQLDirective> getDirectives()
public java.util.Map<java.lang.String,GraphQLDirective> getDirectivesByName()
public GraphQLDirective getDirective(java.lang.String directiveName)
directiveName
- the name of the directive to retrieve@Deprecated public java.util.List<GraphQLDirective> getSchemaDirectives()
GraphQLAppliedDirective
methods insteadgetDirectives()
will return
directives for all schema elements, whereas this is just for the schema
element itself@Deprecated public java.util.Map<java.lang.String,GraphQLDirective> getSchemaDirectiveByName()
GraphQLAppliedDirective
methods insteadgetDirectives()
will return
directives for all schema elements, whereas this is just for the schema
element itself@Deprecated public java.util.Map<java.lang.String,java.util.List<GraphQLDirective>> getAllSchemaDirectivesByName()
GraphQLAppliedDirective
methods insteadgetDirectives()
will return
directives for all schema elements, whereas this is just for the schema
element itself@Deprecated public GraphQLDirective getSchemaDirective(java.lang.String directiveName)
GraphQLAppliedDirective
methods insteadGraphQLDirectiveContainer.getDirective(String)
will return
directives for all schema elements, whereas this is just for the schema
element itselfdirectiveName
- the name of the directive@Deprecated public java.util.List<GraphQLDirective> getSchemaDirectives(java.lang.String directiveName)
GraphQLAppliedDirective
methods insteaddirectiveName
- the name of the directivepublic java.util.List<GraphQLAppliedDirective> getSchemaAppliedDirectives()
getDirectives()
will return
directives for all schema elements, whereas this is just for the schema
element itselfpublic java.util.Map<java.lang.String,java.util.List<GraphQLAppliedDirective>> getAllSchemaAppliedDirectivesByName()
getDirectives()
will return
directives for all schema elements, whereas this is just for the schema
element itselfpublic GraphQLAppliedDirective getSchemaAppliedDirective(java.lang.String directiveName)
GraphQLDirectiveContainer.getDirective(String)
will return
directives for all schema elements, whereas this is just for the schema
element itselfdirectiveName
- the name of the directivepublic java.util.List<GraphQLAppliedDirective> getSchemaAppliedDirectives(java.lang.String directiveName)
@Nullable public @Nullable SchemaDefinition getDefinition()
public java.util.List<SchemaExtensionDefinition> getExtensionDefinitions()
public boolean isSupportingMutations()
public boolean isSupportingSubscriptions()
@Nullable public @Nullable java.lang.String getDescription()
public GraphQLSchema transform(java.util.function.Consumer<GraphQLSchema.Builder> builderConsumer)
builderConsumer
- the consumer code that will be given a builder to transformpublic GraphQLSchema transformWithoutTypes(java.util.function.Consumer<GraphQLSchema.BuilderWithoutTypes> builderConsumer)
builderConsumer
- the consumer code that will be given a builder to transformpublic static GraphQLSchema.Builder newSchema()
public static GraphQLSchema.Builder newSchema(GraphQLSchema existingSchema)
existingSchema
- the existing schema