aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/main/java/com/yahoo/vespa/config/buildergen/ConfigDefinition.java
blob: ea258dc090017134dad724f0016bf486994bc981 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.buildergen;

import com.yahoo.config.codegen.DefParser;
import com.yahoo.config.codegen.InnerCNode;
import com.yahoo.text.StringUtilities;

import java.io.StringReader;

/**
 * Represents a higher level functionality on a config definition to (in the future) hide the InnerCNode class.
 * @author Ulf Lilleengen
 */
public class ConfigDefinition {

    private final String name;
    private final String[] defSchema;
    private final InnerCNode cnode;

    // TODO: Should have namespace
    public ConfigDefinition(String name, String[] defSchema) {
        this.name = name;
        this.defSchema = defSchema;
        this.cnode = new DefParser(name, new StringReader(StringUtilities.implode(defSchema, "\n"))).getTree();
    }

    public InnerCNode getCNode() {
        return cnode;
    }

}