Remove @NotThreadSafe annotations
[yangtools.git] / yang / yang-parser-api / src / main / java / org / opendaylight / yangtools / yang / model / parser / api / YangParserFactory.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, s.r.o. 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.model.parser.api;
9
10 import com.google.common.annotations.Beta;
11 import java.util.Collection;
12 import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
13
14 /**
15  * Basic entry point into a YANG parser implementation. Implementations of this interface are expected to be
16  * thread-safe.
17  *
18  * @author Robert Varga
19  */
20 @Beta
21 public interface YangParserFactory {
22     /**
23      * Return enumeration of {@link StatementParserMode}s supported by this factory.
24      *
25      * @return Enumeration of supported schema source representations.
26      */
27     Collection<StatementParserMode> supportedParserModes();
28
29     /**
30      * Create a {@link YangParser} instance operating in default import resolution mode.
31      *
32      * @return A new {@link YangParser} instance
33      */
34     default YangParser createParser() {
35         return createParser(StatementParserMode.DEFAULT_MODE);
36     }
37
38     /**
39      * Create a {@link YangParser} instance operating in specified import resolution mode.
40      *
41      * @param parserMode Requested parser mode, may not be null.
42      * @return A new {@link YangParser} instance
43      * @throws NullPointerException if parser mode is null
44      * @throws IllegalArgumentException if specified parser mode is not supported
45      */
46     YangParser createParser(StatementParserMode parserMode);
47 }