All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.schema.parser.ParsedFieldSet Maven / Gradle / Ivy

// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema.parser;

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

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

    private final List fields = new ArrayList<>();
    private final List queryCommands = new ArrayList<>();
    private ParsedMatchSettings matchInfo = null;

    ParsedFieldSet(String name) {
        super(name, "fieldset");
    }

    ParsedMatchSettings matchSettings() {
        if (matchInfo == null) matchInfo = new ParsedMatchSettings();
        return this.matchInfo;
    }

    List getQueryCommands() { return List.copyOf(queryCommands); }
    List getFieldNames() { return List.copyOf(fields); }
    Optional getMatchSettings() {
        return Optional.ofNullable(this.matchInfo);
    }

    void addField(String field) { fields.add(field); }
    void addQueryCommand(String command) { queryCommands.add(command); }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy