Add support for overriding statement supports
[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
15 /**
16  * Utility forwarding implementation of {@link EffectiveStatement} contract. This class is useful for implementing
17  * wrapped statements.
18  *
19  * @author Robert Varga
20  *
21  * @param <A> Argument type
22  * @param <D> Declared Statement representation
23  * @param <E> Effective Statement representation
24  */
25 @Beta
26 public abstract class ForwardingEffectiveStatement<A, D extends DeclaredStatement<A>,
27         E extends EffectiveStatement<A, D>> extends ForwardingObject implements EffectiveStatement<A, D> {
28
29     @Override
30     protected abstract E delegate();
31
32
33     @Override
34     public D getDeclared() {
35         return delegate().getDeclared();
36     }
37
38     @Override
39     public <K, V, N extends IdentifierNamespace<K, V>> V get(final Class<N> namespace, final K identifier) {
40         return delegate().get(namespace, identifier);
41     }
42
43     @Override
44     public <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAll(final Class<N> namespace) {
45         return delegate().getAll(namespace);
46     }
47
48     @Override
49     public Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
50         return delegate().effectiveSubstatements();
51     }
52
53     @Override
54     public StatementDefinition statementDefinition() {
55         return delegate().statementDefinition();
56     }
57
58     @Override
59     public A argument() {
60         return delegate().argument();
61     }
62
63     @Override
64     public StatementSource getStatementSource() {
65         return delegate().getStatementSource();
66     }
67 }