2 * Copyright (c) 2018 Pantheon Technologies, s.r.o. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.xpath.api;
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;
16 * Factory for creating {@link YangXPathParser}s. Implementations of this interface are expected to be thread-safe.
18 * @author Robert Varga
21 public interface YangXPathParserFactory {
23 * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode#IEEE754}. Returned parser will not
24 * perform any namespace binding.
26 * @return An XPathParser
28 default YangXPathParser newParser() {
29 return newParser(YangXPathMathMode.IEEE754);
33 * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode}. Returned parser will not perform any
36 * @param mathMode Requested XPath number compliance
37 * @return An XPathParser
38 * @throws NullPointerException if {@code mathMode} is null
40 YangXPathParser newParser(YangXPathMathMode mathMode);
43 * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode#IEEE754}. Returned parser will bind
44 * qualified node identifiers to {@link QName}s.
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
50 default YangXPathParser.QualifiedBound newParser(final YangNamespaceContext namespaceContext) {
51 return newParser(YangXPathMathMode.IEEE754, namespaceContext);
55 * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode}. Returned parser will bind qualified
56 * node identifiers to {@link QName}s.
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
63 YangXPathParser.QualifiedBound newParser(YangXPathMathMode mathMode, YangNamespaceContext namespaceContext);
66 * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode#IEEE754}. Returned parser will bind
67 * qualified and unqualified node identifiers to {@link QName}s.
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
74 default YangXPathParser.UnqualifiedBound newParser(final YangNamespaceContext namespaceContext,
75 final QNameModule defaultNamespace) {
76 return newParser(YangXPathMathMode.IEEE754, namespaceContext, defaultNamespace);
80 * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode}. Returned parser will bind qualified
81 * and unqualified node identifiers to {@link QName}s.
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
89 YangXPathParser.UnqualifiedBound newParser(YangXPathMathMode mathMode, YangNamespaceContext namespaceContext,
90 QNameModule defaultNamespace);