Interface SchemaMappingInspector.Initializer
- Enclosing class:
- SchemaMappingInspector
public static interface SchemaMappingInspector.Initializer
Helps to configure
SchemaMappingInspector
.- Since:
- 1.3.0
-
Method Summary
Modifier and TypeMethodDescriptionclassMapping
(String graphQlTypeName, Class<?>... aClass) Provide an explicit mapping between a GraphQL type name and the Java class(es) that represent it at runtime to help inspect union member and interface implementation types when those associations cannot be discovered otherwise.classNameFunction
(Function<GraphQLObjectType, String> function) Help to derive thesimple class name
for the Java representation of a GraphQL union member or interface implementing type.Alternative toclassMapping(String, Class[])
with a customSchemaMappingInspector.ClassResolver
to find the Java class(es) for a GraphQL union member or interface implementation type.inspect
(GraphQLSchema schema, Map<String, Map<String, DataFetcher>> fetchers) Perform the inspection and return a report.
-
Method Details
-
classMapping
Provide an explicit mapping between a GraphQL type name and the Java class(es) that represent it at runtime to help inspect union member and interface implementation types when those associations cannot be discovered otherwise.Out of the box, there a several ways through which schema inspection can locate such types automatically:
- Java class representations are located in the same package as the
type returned from the controller method for a union or interface field,
and their
simple class names
match GraphQL type names, possibly with the help of aclassNameFunction(java.util.function.Function<graphql.schema.GraphQLObjectType, java.lang.String>)
. - Java class representations are located in the same package as the declaring class of the controller method for a union or interface field.
- Controller methods return the Java class representations of schema fields for concrete union member or interface implementation types.
- Parameters:
graphQlTypeName
- the name of a GraphQL Object typeaClass
- one or more Java class representations- Returns:
- the same initializer instance
- Java class representations are located in the same package as the
type returned from the controller method for a union or interface field,
and their
-
classNameFunction
Help to derive thesimple class name
for the Java representation of a GraphQL union member or interface implementing type. For more details, seeclassMapping(String, Class[])
.By default,
GraphQLObjectType.getName()
is used.- Parameters:
function
- the function to use- Returns:
- the same initializer instance
-
classResolver
Alternative toclassMapping(String, Class[])
with a customSchemaMappingInspector.ClassResolver
to find the Java class(es) for a GraphQL union member or interface implementation type.- Parameters:
resolver
- the resolver to use to find associated Java classes- Returns:
- the same initializer instance
-
inspect
Perform the inspection and return a report.- Parameters:
schema
- the schema to inspectfetchers
- the registered data fetchers- Returns:
- the produced report
-