public TypeDefinitionRegistry buildRegistry(Document document) {
        List<GraphQLError> errors = new ArrayList<>();
        TypeDefinitionRegistry typeRegistry = new TypeDefinitionRegistry();
        List<Definition> definitions = document.getDefinitions();
        for (Definition definition : definitions) {
            if (definition instanceof SDLDefinition) {
                typeRegistry.add((SDLDefinition) definition).ifPresent(errors::add);
            } else {
                errors.add(new NonSDLDefinitionError(definition));
            }
        }
        if (errors.size() > 0) {
            throw new SchemaProblem(errors);
        } else {
            return typeRegistry;
        }
    }
public TypeDefinitionRegistry buildRegistry ( Document document ) { List < GraphQLError > errors = new ArrayList < > ( ) ; TypeDefinitionRegistry typeRegistry = new TypeDefinitionRegistry ( ) ; List < Definition > definitions = document . getDefinitions ( ) ; for ( Definition definition : definitions ) { if ( definition instanceof SDLDefinition ) { typeRegistry . add ( ( SDLDefinition ) definition ) . ifPresent ( errors :: add ) ; } else { errors . add ( new NonSDLDefinitionError ( definition ) ) ; } } if ( errors . size ( ) > 0 ) { throw new SchemaProblem ( errors ) ; } else { return typeRegistry ; } }
special method to build directly a TypeDefinitionRegistry from a Document
useful for Introspection =&gt; IDL (Document) =&gt; TypeDefinitionRegistry

@param document containing type definitions

@return the TypeDefinitionRegistry containing all type definitions from the document

@throws SchemaProblem if an error occurs