static Map build()

in module/geb-core/src/main/groovy/geb/content/PageContentTemplateBuilder.groovy [48:76]


    static Map<String, PageContentTemplate> build(Browser browser, PageContentContainer container, NavigatorFactory navigatorFactory, String property, Class startAt, Class stopAt = Object) {
        if (!stopAt.isAssignableFrom(startAt)) {
            throw new IllegalArgumentException("$startAt is not a subclass of $stopAt")
        }

        def templatesDefinitions = []
        def clazz = startAt

        while (clazz != stopAt) {
            def templatesDefinition
            // noinspection GroovyUnusedCatchParameter
            try {
                templatesDefinition = clazz[property]
            } catch (MissingPropertyException e) {
                // swallow
            }

            if (templatesDefinition) {
                if (!(templatesDefinition instanceof Closure)) {
                    throw new IllegalArgumentException("'$property' static property of class $clazz should be a Closure")
                }
                templatesDefinitions << templatesDefinition.clone()
            }

            clazz = clazz.superclass
        }

        build(browser, container, navigatorFactory, templatesDefinitions.reverse())
    }