Package graphql.schema.idl
Interface WiringFactory
-
- All Known Implementing Classes:
CombinedWiringFactory,EchoingWiringFactory,MockedWiringFactory,NoopWiringFactory
@PublicSpi public interface WiringFactory
A WiringFactory allows you to more dynamically wire inTypeResolvers andDataFetchers based on the IDL definitions. For example you could look at the directives say to build a more dynamic set of type resolvers and data fetchers.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default DataFetchergetDataFetcher(FieldWiringEnvironment environment)Returns aDataFetchergiven the type definitiondefault <T> DataFetcherFactory<T>getDataFetcherFactory(FieldWiringEnvironment environment)Returns aDataFetcherFactorygiven the type definitiondefault DataFetchergetDefaultDataFetcher(FieldWiringEnvironment environment)All fields need a data fetcher of some sort and this method is called to provide the data fetcher that will be used if no specific one has been provideddefault GraphQLScalarTypegetScalar(ScalarWiringEnvironment environment)Returns aGraphQLScalarTypegiven scalar defined in IDLdefault SchemaDirectiveWiringgetSchemaDirectiveWiring(SchemaDirectiveWiringEnvironment environment)Returns aSchemaDirectiveWiringgiven the environmentdefault TypeResolvergetTypeResolver(InterfaceWiringEnvironment environment)Returns aTypeResolvergiven the type interfacedefault TypeResolvergetTypeResolver(UnionWiringEnvironment environment)Returns aTypeResolvergiven the type uniondefault booleanprovidesDataFetcher(FieldWiringEnvironment environment)This is called to ask if this factory can provide a data fetcher for the definitiondefault booleanprovidesDataFetcherFactory(FieldWiringEnvironment environment)This is called to ask if this factory can provide aDataFetcherFactoryfor the definitiondefault booleanprovidesScalar(ScalarWiringEnvironment environment)This is called to ask if this factory can provide a custom scalardefault booleanprovidesSchemaDirectiveWiring(SchemaDirectiveWiringEnvironment environment)This is called to ask if this factory can provide a schema directive wiring.default booleanprovidesTypeResolver(InterfaceWiringEnvironment environment)This is called to ask if this factory can provide a type resolver for the interfacedefault booleanprovidesTypeResolver(UnionWiringEnvironment environment)This is called to ask if this factory can provide a type resolver for the union
-
-
-
Method Detail
-
providesScalar
default boolean providesScalar(ScalarWiringEnvironment environment)
This is called to ask if this factory can provide a custom scalar- Parameters:
environment- the wiring environment- Returns:
- true if the factory can give out a type resolver
-
getScalar
default GraphQLScalarType getScalar(ScalarWiringEnvironment environment)
Returns aGraphQLScalarTypegiven scalar defined in IDL- Parameters:
environment- the wiring environment- Returns:
- a
GraphQLScalarType
-
providesTypeResolver
default boolean providesTypeResolver(InterfaceWiringEnvironment environment)
This is called to ask if this factory can provide a type resolver for the interface- Parameters:
environment- the wiring environment- Returns:
- true if the factory can give out a type resolver
-
getTypeResolver
default TypeResolver getTypeResolver(InterfaceWiringEnvironment environment)
Returns aTypeResolvergiven the type interface- Parameters:
environment- the wiring environment- Returns:
- a
TypeResolver
-
providesTypeResolver
default boolean providesTypeResolver(UnionWiringEnvironment environment)
This is called to ask if this factory can provide a type resolver for the union- Parameters:
environment- the wiring environment- Returns:
- true if the factory can give out a type resolver
-
getTypeResolver
default TypeResolver getTypeResolver(UnionWiringEnvironment environment)
Returns aTypeResolvergiven the type union- Parameters:
environment- the union wiring environment- Returns:
- a
TypeResolver
-
providesDataFetcherFactory
default boolean providesDataFetcherFactory(FieldWiringEnvironment environment)
This is called to ask if this factory can provide aDataFetcherFactoryfor the definition- Parameters:
environment- the wiring environment- Returns:
- true if the factory can give out a data fetcher factory
-
getDataFetcherFactory
default <T> DataFetcherFactory<T> getDataFetcherFactory(FieldWiringEnvironment environment)
Returns aDataFetcherFactorygiven the type definition- Type Parameters:
T- the type of the data fetcher- Parameters:
environment- the wiring environment- Returns:
- a
DataFetcherFactory
-
providesSchemaDirectiveWiring
default boolean providesSchemaDirectiveWiring(SchemaDirectiveWiringEnvironment environment)
This is called to ask if this factory can provide a schema directive wiring.SchemaDirectiveWiringEnvironment.getDirectives()contains all the directives available which may in fact be an empty list.- Parameters:
environment- the calling environment- Returns:
- true if the factory can give out a schema directive wiring.
-
getSchemaDirectiveWiring
default SchemaDirectiveWiring getSchemaDirectiveWiring(SchemaDirectiveWiringEnvironment environment)
Returns aSchemaDirectiveWiringgiven the environment- Parameters:
environment- the calling environment- Returns:
- a
SchemaDirectiveWiring
-
providesDataFetcher
default boolean providesDataFetcher(FieldWiringEnvironment environment)
This is called to ask if this factory can provide a data fetcher for the definition- Parameters:
environment- the wiring environment- Returns:
- true if the factory can give out a data fetcher
-
getDataFetcher
default DataFetcher getDataFetcher(FieldWiringEnvironment environment)
Returns aDataFetchergiven the type definition- Parameters:
environment- the wiring environment- Returns:
- a
DataFetcher
-
getDefaultDataFetcher
default DataFetcher getDefaultDataFetcher(FieldWiringEnvironment environment)
All fields need a data fetcher of some sort and this method is called to provide the data fetcher that will be used if no specific one has been provided- Parameters:
environment- the wiring environment- Returns:
- a
DataFetcher
-
-