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.mdsal.binding.runtime.spi;
10 import java.util.ServiceLoader;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
12 import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeGenerator;
13 import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
16 * State derived from ServiceLoader. We statically bind to this state. If you need more dynamics, you should not be
17 * showing up here at all.
20 final class ServiceLoaderState {
21 static final class Generator {
22 static final BindingRuntimeGenerator INSTANCE = ServiceLoader.load(BindingRuntimeGenerator.class).findFirst()
23 .orElseThrow(() -> new ExceptionInInitializerError("No BindingRuntimeGenerator found"));
30 static final class ParserFactory {
31 static final YangParserFactory INSTANCE = ServiceLoader.load(YangParserFactory.class).findFirst()
32 .orElseThrow(() -> new ExceptionInInitializerError("No YangParserFactory found"));
34 private ParserFactory() {
39 private ServiceLoaderState() {