2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. 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.parser.rfc7950.reactor;
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;
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.
21 final class ServiceLoaderState {
22 static final class DefaultReactor {
23 static final CrossSourceStatementReactor INSTANCE = RFC7950Reactors.defaultReactorBuilder().build();
26 static final class VanillaReactor {
27 static final CrossSourceStatementReactor INSTANCE = RFC7950Reactors.vanillaReactorBuilder().build();
30 static final class XPath {
31 static final XPathSupport INSTANCE = new XPathSupport(ServiceLoader.load(YangXPathParserFactory.class)
32 .findFirst().orElseThrow(() -> new ExceptionInInitializerError("No YangXPathParserFactory found")));