Merge branch 'master' of ../controller
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / meta / ForwardingEffectiveStatement.java
1 /*
2  * Copyright (c) 2017 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.yangtools.yang.model.api.meta;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ForwardingObject;
12 import java.util.Collection;
13 import java.util.Map;
14 import java.util.Optional;
15
16 /**
17  * Utility forwarding implementation of {@link EffectiveStatement} contract. This class is useful for implementing
18  * wrapped statements.
19  *
20  * @author Robert Varga
21  *
22  * @param <A> Argument type
23  * @param <D> Declared Statement representation
24  * @param <E> Effective Statement representation
25  */
26 @Beta
27 public abstract class ForwardingEffectiveStatement<A, D extends DeclaredStatement<A>,
28         E extends EffectiveStatement<A, D>> extends ForwardingObject implements EffectiveStatement<A, D> {
29
30     @Override
31     protected abstract E delegate();
32
33
34     @Override
35     public D getDeclared() {
36         return delegate().getDeclared();
37     }
38
39     @Override
40     public <K, V, N extends IdentifierNamespace<K, V>> Optional<? extends V> get(final Class<N> namespace,
41             final K identifier) {
42         return delegate().get(namespace, identifier);
43     }
44
45     @Override
46     public <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAll(final Class<N> namespace) {
47         return delegate().getAll(namespace);
48     }
49
50     @Override
51     public Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
52         return delegate().effectiveSubstatements();
53     }
54
55     @Override
56     public StatementDefinition statementDefinition() {
57         return delegate().statementDefinition();
58     }
59
60     @Override
61     public A argument() {
62         return delegate().argument();
63     }
64
65     @Override
66     public StatementSource getStatementSource() {
67         return delegate().getStatementSource();
68     }
69 }