public GraphQLSchemaDfsTraversal(Class<?> schemaClass, GraphQLSchemaConfig graphQLSchemaConfig, GraphQLSchemaBeanFactory graphQLSchemaBeanFactory) { this.schemaClass = schemaClass; this.graphQLSchemaConfig = graphQLSchemaConfig; this.graphQLSchemaBeanFactory = graphQLSchemaBeanFactory; this.graphQLMappingContext = new GraphQLMappingContext(this.graphQLSchemaConfig); this.objectTypeResolverMap = new ConcurrentHashMap<>(); this.objectTypeNameReferenceMap = new ConcurrentHashMap<>(); this.objectNameTypeReferenceMap = new ConcurrentHashMap<>(); this.mutationReturnTypeResolverMap = new LinkedHashMap<>(); this.mutationInputTypeResolverMap = new LinkedHashMap<>(); this.fieldDefinitionResolverMap = new LinkedHashMap<>(); this.graphQLUnionTypeMap = new HashSet<>(); }
public GraphQLScalarType getScalarGraphQLType(final Type cls) { GraphQLScalarType graphQLScalarType = MappingConstants.getScalarGraphQLType(cls); if (Date.class.isAssignableFrom((Class<?>) cls)) { if (graphQLSchemaConfig.isDateAsTimestamp()) graphQLScalarType = MappingConstants.graphQLTimestamp; else graphQLScalarType = getGraphQLDateType(); } else if (LocalDateTime.class.isAssignableFrom((Class<?>) cls)) { if (graphQLSchemaConfig.isDateAsTimestamp()) graphQLScalarType = MappingConstants.graphQLTimestamp; else graphQLScalarType = getGraphQLDateType(); } return graphQLScalarType; }
public GraphQLType createGraphQLFieldType(DfsContext dfsContext, ResolvableTypeAccessor resolvableTypeAccessor, boolean isRecursive) { boolean isContainer = resolvableTypeAccessor.isCollectionLike(); Class<?> cls = resolvableTypeAccessor.getActualType(); GraphQLType graphQLType = resolvableTypeAccessor.isGraphQLId() ? Scalars.GraphQLID : getGraphQLMappingContext().getScalarGraphQLType(cls); // complex object if (graphQLType == null && isRecursive) { graphQLType = createGraphQLObjectTypeRecursively(dfsContext, cls); } if (graphQLType != null) { if (isContainer) { graphQLType = new GraphQLList(graphQLType); } else { graphQLType = resolvableTypeAccessor.isNotNull() ? new GraphQLNonNull(graphQLType) : graphQLType; } } return graphQLType; }