Do not issue duplicate warnings for lists missing keys
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / reactor / ServiceLoaderState.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, 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.parser.rfc7950.reactor;
9
10 import java.util.ServiceLoader;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
12 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.XPathSupport;
13 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
14 import org.opendaylight.yangtools.yang.xpath.api.YangXPathParserFactory;
15
16 /**
17  * State derived from ServiceLoader. We statically bind to this state. If you need more dynamics, you should not be
18  * showing up here at all.
19  */
20 @NonNullByDefault
21 final class ServiceLoaderState {
22     static final class DefaultReactor {
23         static final CrossSourceStatementReactor INSTANCE = RFC7950Reactors.defaultReactorBuilder().build();
24     }
25
26     static final class VanillaReactor {
27         static final CrossSourceStatementReactor INSTANCE = RFC7950Reactors.vanillaReactorBuilder().build();
28     }
29
30     static final class XPath {
31         static final XPathSupport INSTANCE = new XPathSupport(ServiceLoader.load(YangXPathParserFactory.class)
32             .findFirst().orElseThrow(() -> new ExceptionInInitializerError("No YangXPathParserFactory found")));
33     }
34 }