2 * Copyright (c) 2018 Pantheon Technologies, 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.dom.adapter;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import java.util.ServiceLoader;
14 import javax.inject.Inject;
15 import javax.inject.Singleton;
16 import org.eclipse.jdt.annotation.NonNullByDefault;
17 import org.kohsuke.MetaInfServices;
18 import org.opendaylight.mdsal.binding.dom.adapter.spi.AdapterFactory;
19 import org.opendaylight.yangtools.concepts.Immutable;
22 * Implementation of AdapterFactory.
24 * @author Robert Varga
27 @MetaInfServices(value = AdapterFactory.class)
30 public final class BindingAdapterFactory extends AbstractAdapterFactory implements Immutable {
31 private final AdapterContext codec;
33 public BindingAdapterFactory() {
34 this(ServiceLoader.load(AdapterContext.class).findFirst()
35 .orElseThrow(() -> new IllegalStateException("Failed to load BlockingBindingNormalizer")));
39 public BindingAdapterFactory(final AdapterContext codec) {
40 this.codec = requireNonNull(codec);
44 AdapterContext context() {