summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedAnnotation.java
blob: a4e387958508ca37e4e063fc5af6c2a89db548ec (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
package com.yahoo.searchdefinition.parser;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * This class holds the extracted information after parsing a
 * "annotation" block, using simple data structures as far as
 * possible.  Do not put advanced logic here!
 * @author arnej27959
 **/
class ParsedAnnotation extends ParsedBlock {

    private ParsedStruct wrappedStruct = null;
    private final List<String> inherited = new ArrayList<>();

    ParsedAnnotation(String name) {
        super(name, "annotation");
    }

    public List<String> getInherited() { return List.copyOf(inherited); }
    public Optional<ParsedStruct> getStruct() { return Optional.ofNullable(wrappedStruct); }

    void setStruct(ParsedStruct struct) { this.wrappedStruct = struct; }
    void inherit(String other) { inherited.add(other); }
}