@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 |
Constructor and Description |
---|
GraphQLSchema(GraphQLObjectType queryType)
Deprecated.
use the
newSchema() builder pattern instead, as this constructor will be made private in a future version. |
GraphQLSchema(GraphQLObjectType queryType,
GraphQLObjectType mutationType,
GraphQLObjectType subscriptionType,
java.util.Set<GraphQLType> additionalTypes)
Deprecated.
use the
newSchema() builder pattern instead, as this constructor will be made private in a future version. |
GraphQLSchema(GraphQLObjectType queryType,
GraphQLObjectType mutationType,
java.util.Set<GraphQLType> additionalTypes)
Deprecated.
use the
newSchema() builder pattern instead, as this constructor will be made private in a future version. |
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.Map<java.lang.String,java.util.List<GraphQLDirective>> |
getAllDirectivesByName()
Directives can be `repeatable` and hence this returns a list of directives by name, some with an arity of 1 and some with an arity of greater than
1.
|
java.util.Map<java.lang.String,java.util.List<GraphQLDirective>> |
getAllSchemaDirectivesByName()
Schema directives can be `repeatable` and hence this returns a list of directives by name, some with an arity of 1 and some with an arity of greater than
1.
|
java.util.List<GraphQLNamedType> |
getAllTypesAsList() |
GraphQLCodeRegistry |
getCodeRegistry() |
SchemaDefinition |
getDefinition() |
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 that are associated with this schema object including
built in ones.
|
java.util.List<GraphQLDirective> |
getDirectives(java.lang.String directiveName)
Returns a list of named directive that can include non repeatable and repeatable directives.
|
java.util.Map<java.lang.String,GraphQLDirective> |
getDirectivesByName() |
java.util.List<SchemaExtensionDefinition> |
getExtensionDefinitions() |
GraphqlFieldVisibility |
getFieldVisibility()
Deprecated.
use
GraphQLCodeRegistry.getFieldVisibility() instead |
GraphQLDirective |
getFirstDirective(java.lang.String directiveName)
Returns a the first named directive that can include non repeatable and repeatable directives
or null if there is not one called that name
|
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() |
GraphQLDirective |
getSchemaDirective(java.lang.String directiveName)
This returns the named directive that have been explicitly put on the
schema object.
|
java.util.Map<java.lang.String,GraphQLDirective> |
getSchemaDirectiveByName()
This returns a map of non repeatable directives that have been explicitly put on the
schema object.
|
java.util.List<GraphQLDirective> |
getSchemaDirectives()
This returns the list of directives that have been explicitly put on the
schema object.
|
java.util.List<GraphQLDirective> |
getSchemaDirectives(java.lang.String directiveName) |
GraphQLObjectType |
getSubscriptionType() |
GraphQLType |
getType(java.lang.String typeName)
Gets the named type from the schema or null if its not present
|
<T extends GraphQLType> |
getTypeAs(java.lang.String typeName)
Gets the named type from the schema or null if its not present.
|
java.util.Map<java.lang.String,GraphQLNamedType> |
getTypeMap() |
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.
|
@Deprecated public GraphQLSchema(GraphQLObjectType queryType)
newSchema()
builder pattern instead, as this constructor will be made private in a future version.queryType
- the query type@Deprecated public GraphQLSchema(GraphQLObjectType queryType, GraphQLObjectType mutationType, java.util.Set<GraphQLType> additionalTypes)
newSchema()
builder pattern instead, as this constructor will be made private in a future version.queryType
- the query typemutationType
- the mutation typeadditionalTypes
- additional types@Deprecated public GraphQLSchema(GraphQLObjectType queryType, GraphQLObjectType mutationType, GraphQLObjectType subscriptionType, java.util.Set<GraphQLType> additionalTypes)
newSchema()
builder pattern instead, as this constructor will be made private in a future version.queryType
- the query typemutationType
- the mutation typesubscriptionType
- the subscription typeadditionalTypes
- additional typespublic static GraphQLSchema.Builder newSchema()
public static GraphQLSchema.Builder newSchema(GraphQLSchema existingSchema)
existingSchema
- the existing schemapublic GraphQLCodeRegistry getCodeRegistry()
public GraphQLFieldDefinition getIntrospectionSchemaFieldDefinition()
public GraphQLFieldDefinition getIntrospectionTypeFieldDefinition()
public GraphQLFieldDefinition getIntrospectionTypenameFieldDefinition()
public GraphQLObjectType getIntrospectionSchemaType()
public java.util.Set<GraphQLType> getAdditionalTypes()
public GraphQLType getType(java.lang.String typeName)
typeName
- the name of the type to retrievepublic <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 java.util.Map<java.lang.String,GraphQLNamedType> getTypeMap()
public java.util.List<GraphQLNamedType> getAllTypesAsList()
public 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 java.util.Map<java.lang.String,java.util.List<GraphQLDirective>> getAllDirectivesByName()
public GraphQLDirective getDirective(java.lang.String directiveName)
directiveName
- the name of the directive to retrievepublic java.util.List<GraphQLDirective> getDirectives(java.lang.String directiveName)
directiveName
- the name of the directives to retrievepublic GraphQLDirective getFirstDirective(java.lang.String directiveName)
directiveName
- the name of the directives to retrievepublic java.util.List<GraphQLDirective> getSchemaDirectives()
getDirectives()
will return
directives for all schema elements, whereas this is just for the schema
element itselfpublic java.util.Map<java.lang.String,GraphQLDirective> getSchemaDirectiveByName()
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<GraphQLDirective>> getAllSchemaDirectivesByName()
public GraphQLDirective getSchemaDirective(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<GraphQLDirective> getSchemaDirectives(java.lang.String directiveName)
public SchemaDefinition getDefinition()
public java.util.List<SchemaExtensionDefinition> getExtensionDefinitions()
public boolean isSupportingMutations()
public boolean isSupportingSubscriptions()
public 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 transform