Interface WiringFactory

All Known Implementing Classes:
CombinedWiringFactory, EchoingWiringFactory, MockedWiringFactory, NoopWiringFactory

@PublicSpi public interface WiringFactory
A WiringFactory allows you to more dynamically wire in TypeResolvers and DataFetchers 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 Details

    • 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 a GraphQLScalarType 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 a TypeResolver 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 a TypeResolver 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 a DataFetcherFactory 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 a DataFetcherFactory 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 a SchemaDirectiveWiring 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 a DataFetcher 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