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 inTypeResolver
s andDataFetcher
s 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 DataFetcher
getDataFetcher(FieldWiringEnvironment environment)
Returns aDataFetcher
given the type definitiondefault <T> DataFetcherFactory<T>
getDataFetcherFactory(FieldWiringEnvironment environment)
Returns aDataFetcherFactory
given the type definitiondefault 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 provideddefault GraphQLScalarType
getScalar(ScalarWiringEnvironment environment)
Returns aGraphQLScalarType
given scalar defined in IDLdefault SchemaDirectiveWiring
getSchemaDirectiveWiring(SchemaDirectiveWiringEnvironment environment)
Returns aSchemaDirectiveWiring
given the environmentdefault TypeResolver
getTypeResolver(InterfaceWiringEnvironment environment)
Returns aTypeResolver
given the type interfacedefault TypeResolver
getTypeResolver(UnionWiringEnvironment environment)
Returns aTypeResolver
given the type uniondefault boolean
providesDataFetcher(FieldWiringEnvironment environment)
This is called to ask if this factory can provide a data fetcher for the definitiondefault boolean
providesDataFetcherFactory(FieldWiringEnvironment environment)
This is called to ask if this factory can provide aDataFetcherFactory
for the definitiondefault boolean
providesScalar(ScalarWiringEnvironment environment)
This is called to ask if this factory can provide a custom scalardefault boolean
providesSchemaDirectiveWiring(SchemaDirectiveWiringEnvironment environment)
This is called to ask if this factory can provide a schema directive wiring.default boolean
providesTypeResolver(InterfaceWiringEnvironment environment)
This is called to ask if this factory can provide a type resolver for the interfacedefault boolean
providesTypeResolver(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 aGraphQLScalarType
given 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 aTypeResolver
given 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 aTypeResolver
given 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 aDataFetcherFactory
for 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 aDataFetcherFactory
given 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 aSchemaDirectiveWiring
given 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 aDataFetcher
given 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
-
-