Fix eclipse/checkstyle warnings
[yangtools.git] / yang / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / schema / xpath / XPathSchemaContext.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.data.api.schema.xpath;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.base.Converter;
12 import javax.annotation.Nonnull;
13 import javax.xml.xpath.XPathExpressionException;
14 import org.opendaylight.yangtools.yang.common.QNameModule;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
17
18 /**
19  * A schema-informed XPath context. It supports creation of {@link XPathDocument}s, which are bound to
20  * a particular root node.
21  */
22 @Beta
23 public interface XPathSchemaContext {
24     /**
25      * Compile an XPath expression for execution on {@link XPathDocument}s produced by this context.
26      *
27      * <p>
28      * The user must provide a prefix-to-mapping {@link Converter}, which will be used to convert any prefixes found
29      * in the XPath expression being compiled in the resulting context.
30      *
31      * @param schemaPath Schema path of the node at which this expression is expected to be evaluated
32      * @param prefixes Prefix-to-namespace converter
33      * @param xpath XPath expression to compile
34      * @return A compiled XPath expression
35      * @throws XPathExpressionException if the provided expression is invalid, either syntactically or by referencing
36      *         namespaces unknown to this schema context.
37      */
38     @Nonnull XPathExpression compileExpression(@Nonnull SchemaPath schemaPath,
39             Converter<String, QNameModule> prefixes, @Nonnull String xpath) throws XPathExpressionException;
40
41     /**
42      * Create a new document context.
43      *
44      * @param documentRoot Root node of the document
45      * @return A new {@link XPathDocument} on which queries may be executed.
46      * @throws IllegalArgumentException if the document root is not known to this schema context.
47      */
48     @Nonnull XPathDocument createDocument(@Nonnull NormalizedNode<?, ?> documentRoot);
49 }