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

com.yahoo.vespa.model.search.SchemaDefinitionXMLHandler Maven / Gradle / Ivy

There is a newer version: 8.409.18
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.search;

import com.yahoo.schema.Schema;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;

import java.io.Serializable;
import java.util.List;

/**
 * Represents a single schema file.
 *
 * @author arnej27959
 */
public class SchemaDefinitionXMLHandler implements Serializable {

    private String schemaName;

    public SchemaDefinitionXMLHandler(ModelElement elem) {
        schemaName = elem.stringAttribute("name");
        if (schemaName == null) {
            schemaName = elem.stringAttribute("type");
        }
    }

    public String getName() { return schemaName; }

    public Schema findResponsibleSchema(List schemas) {
        for (Schema candidate : schemas) {
            if (candidate.getName().equals(schemaName) )
                return candidate;
        }
        return null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy