Update yang-xpath-api design
[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 javax.annotation.concurrent.ThreadSafe;
12 import org.opendaylight.yangtools.yang.common.YangNamespaceContext;
13
14 /**
15  * Factory for creating {@link YangXPathParser}s.
16  *
17  * @author Robert Varga
18  */
19 @Beta
20 @ThreadSafe
21 public interface YangXPathParserFactory {
22     /**
23      * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode#IEEE754}.
24      *
25      * @param namespaceContext Prefix-to-namespace resolver
26      * @return An XPathParser
27      * @throws NullPointerException if {@code namespaceContext} is null
28      */
29     default YangXPathParser newParser(final YangNamespaceContext namespaceContext) {
30         return newParser(namespaceContext, YangXPathMathMode.IEEE754);
31     }
32
33     /**
34      * Return a {@link YangXPathParser} compliant with {@link YangXPathMathMode}.
35      *
36      * @param namespaceContext Prefix-to-namespace resolver
37      * @param mathMode Requested XPath number compliance
38      * @return An XPathParser
39      * @throws NullPointerException if any argument is null
40      */
41     YangXPathParser newParser(YangNamespaceContext namespaceContext, YangXPathMathMode mathMode);
42 }