Bump upstreams
[netconf.git] / plugins / netconf-common-mdsal / src / main / java / org / opendaylight / netconf / common / mdsal / ProxyMountPointContext.java
1 /*
2  * Copyright (c) 2021 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.netconf.common.mdsal;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.util.Optional;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.yangtools.concepts.Delegator;
15 import org.opendaylight.yangtools.yang.common.MountPointLabel;
16 import org.opendaylight.yangtools.yang.data.api.schema.MountPointContext;
17 import org.opendaylight.yangtools.yang.data.api.schema.MountPointContextFactory;
18 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
19
20 /**
21  * A simple proxy, masking the model context towards ProxyEffectiveModelContext.
22  */
23 final class ProxyMountPointContext implements Delegator<MountPointContext>, MountPointContext {
24     private final @NonNull MountPointContext delegate;
25
26     ProxyMountPointContext(final MountPointContext delegate) {
27         this.delegate = requireNonNull(delegate);
28     }
29
30     @Override
31     public MountPointContext getDelegate() {
32         return delegate;
33     }
34
35     @Override
36     public EffectiveModelContext getEffectiveModelContext() {
37         return new ProxyEffectiveModelContext(delegate.getEffectiveModelContext());
38     }
39
40     @Override
41     public Optional<MountPointContextFactory> findMountPoint(final MountPointLabel label) {
42         return delegate.findMountPoint(label);
43     }
44 }