aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/searchdefinition/DocumentReferences.java
blob: 782424d6b706cbb8a5abfcc07ba1f0312183cd94 (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
28
29
30
31
32
33
// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition;

import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
import java.util.stream.Stream;

/**
 * Contains all document references for a document mapped by field name
 *
 * @author bjorncs
 */
public class DocumentReferences implements Iterable<Map.Entry<String, DocumentReference>> {
    private final Map<String, DocumentReference> references;

    public DocumentReferences(Map<String, DocumentReference> references) {
        this.references = references;
    }

    @Override
    public Iterator<Map.Entry<String, DocumentReference>> iterator() {
        return Collections.unmodifiableSet(references.entrySet()).iterator();
    }

    public Map<String, DocumentReference> referenceMap() {
        return Collections.unmodifiableMap(references);
    }

    public Stream<Map.Entry<String, DocumentReference>> stream() {
        return references.entrySet().stream();
    }
}