private void copySection()

in src/main/java/org/apache/sling/graphql/schema/aggregator/impl/DefaultSchemaAggregator.java [70:91]


    private void copySection(Set<Partial> selected, Partial.SectionName sectionName, OutputMode mode, Writer target) throws IOException {
        String prefixToWrite = (mode == OutputMode.NO_BLOCK) ? null : String.format("%ntype %s {%n", capitalize(sectionName));
        boolean anyOutput = false;
        for(Partial p : selected) {
            final Optional<Partial.Section> section = p.getSection(sectionName);
            if(section.isPresent()) {
                anyOutput = true;
                if(prefixToWrite != null) {
                    target.write(prefixToWrite);
                    prefixToWrite = null;
                }
                writeSourceInfo(target, p);
                IOUtils.copy(section.get().getContent(), target);
            } else if(mode == OutputMode.WITH_BLOCK && prefixToWrite != null) {
                target.write(prefixToWrite);
                prefixToWrite = null;
            }
        }
        if( (anyOutput && mode == OutputMode.WITH_BLOCK_IF_NOT_EMPTY) || mode == OutputMode.WITH_BLOCK) {
            target.write(String.format("%n}%n"));
        }
    }