aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/pagetemplates/SourceVisitor.java
blob: f0826095eda6bd1b8d5c30e572d04d666223ae48 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.pagetemplates;

import com.yahoo.search.pagetemplates.model.PageTemplateVisitor;
import com.yahoo.search.pagetemplates.model.Source;

import java.util.HashSet;
import java.util.Set;

/**
 * Visits a page template object structure and records the sources mentioned.
 *
 * @author bratseth
 */
class SourceVisitor extends PageTemplateVisitor {

    private Set<Source> sources=new HashSet<>();

    @Override
    public void visit(Source source) {
        sources.add(source);
    }

    /** Returns the live list of sources collected by this during visiting */
    public Set<Source> getSources() { return sources; }

}