Cleanup AbstractBindingAdapter
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / main / java / org / opendaylight / mdsal / binding / dom / adapter / AbstractBindingAdapter.java
1 /*
2  * Copyright (c) 2018 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.mdsal.binding.dom.adapter;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.concepts.Delegator;
14
15 abstract class AbstractBindingAdapter<T> implements Delegator<T> {
16     private final @NonNull AdapterContext adapterContext;
17     private final @NonNull T delegate;
18
19     AbstractBindingAdapter(final AdapterContext adapterContext, final T delegate) {
20         this.adapterContext = requireNonNull(adapterContext);
21         this.delegate = requireNonNull(delegate);
22     }
23
24     @Override
25     public final T getDelegate() {
26         return delegate;
27     }
28
29     protected final @NonNull AdapterContext adapterContext() {
30         return adapterContext;
31     }
32
33     protected final @NonNull CurrentAdapterSerializer currentSerializer() {
34         return adapterContext.currentSerializer();
35     }
36 }