Populate model/ hierarchy
[yangtools.git] / yang / yang-xpath-api / src / main / java / org / opendaylight / yangtools / yang / xpath / api / YangXPathParserFactory.java
1 /*
2  * Copyright (c) 2018 Pantheon Technologies, s.r.o.  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.xpath.api;
9
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.yangtools.yang.common.QName;
12 import org.opendaylight.yangtools.yang.common.QNameModule;
13 import org.opendaylight.yangtools.yang.common.YangNamespaceContext;
14
15 /**
16  * Factory for creating {@link YangXPathParser}s. Implementations of this interface are expected to be thread-safe.
17  *
18  * @author Robert Varga
19  */
20 @Beta
21 public interface YangXPathParserFactory {
22     /**
23      * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode#IEEE754}. Returned parser will not
24      * perform any namespace binding.
25      *
26      * @return An XPathParser
27      */
28     default YangXPathParser newParser() {
29         return newParser(YangXPathMathMode.IEEE754);
30     }
31
32     /**
33      * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode}. Returned parser will not perform any
34      * namespace binding.
35      *
36      * @param mathMode Requested XPath number compliance
37      * @return An XPathParser
38      * @throws NullPointerException if {@code mathMode} is null
39      */
40     YangXPathParser newParser(YangXPathMathMode mathMode);
41
42     /**
43      * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode#IEEE754}. Returned parser will bind
44      * qualified node identifiers to {@link QName}s.
45      *
46      * @param namespaceContext Prefix-to-namespace resolver, used to bind qualified node identifiers
47      * @return An XPathParser
48      * @throws NullPointerException if {@code namespaceContext} is null
49      */
50     default YangXPathParser.QualifiedBound newParser(final YangNamespaceContext namespaceContext) {
51         return newParser(YangXPathMathMode.IEEE754, namespaceContext);
52     }
53
54     /**
55      * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode}. Returned parser will bind qualified
56      * node identifiers to {@link QName}s.
57      *
58      * @param mathMode Requested XPath number compliance
59      * @param namespaceContext Prefix-to-namespace resolver, used to bind qualified node identifiers
60      * @return An XPathParser
61      * @throws NullPointerException if any argument is null
62      */
63     YangXPathParser.QualifiedBound newParser(YangXPathMathMode mathMode, YangNamespaceContext namespaceContext);
64
65     /**
66      * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode#IEEE754}. Returned parser will bind
67      * qualified and unqualified node identifiers to {@link QName}s.
68      *
69      * @param namespaceContext Prefix-to-namespace resolver, used to bind qualified node identifiers
70      * @param defaultNamespace Default namespace, used to bind unqualified node identifiers
71      * @return An XPathParser
72      * @throws NullPointerException if any argument is null
73      */
74     default YangXPathParser.UnqualifiedBound newParser(final YangNamespaceContext namespaceContext,
75             final QNameModule defaultNamespace) {
76         return newParser(YangXPathMathMode.IEEE754, namespaceContext, defaultNamespace);
77     }
78
79     /**
80      * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode}. Returned parser will bind qualified
81      * and unqualified node identifiers to {@link QName}s.
82      *
83      * @param mathMode Requested XPath number compliance
84      * @param namespaceContext Prefix-to-namespace resolver, used to bind qualified node identifiers
85      * @param defaultNamespace Default namespace, used to bind unqualified node identifiers
86      * @return An XPathParser
87      * @throws NullPointerException if any argument is null
88      */
89     YangXPathParser.UnqualifiedBound newParser(YangXPathMathMode mathMode, YangNamespaceContext namespaceContext,
90             QNameModule defaultNamespace);
91 }