Cleanup yang.model.api.meta
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / meta / EffectiveStatement.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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 java.util.Collection;
11 import java.util.Map;
12 import javax.annotation.Nonnull;
13 import javax.annotation.Nullable;
14
15 /**
16  * Effective model statement which should be used to derive application behaviour.
17  *
18  * @param <A>
19  *            Argument type ({@link Void} if statement does not have argument.)
20  * @param <S>
21  *            Class representing declared version of this statement.
22  */
23 public interface EffectiveStatement<A, S extends DeclaredStatement<A>> extends ModelStatement<A> {
24
25     /**
26      * Returns statement, which was explicit declaration of this effective
27      * statement.
28      *
29      *
30      * @return statement, which was explicit declaration of this effective
31      *         statement or null if statement was inferred from context.
32      */
33     @Nullable
34     S getDeclared();
35
36     /**
37      * Returns value associated with supplied identifier
38      *
39      * @param <K>
40      *            Identifier type
41      * @param <V>
42      *            Value type
43      * @param <N>
44      *            Namespace identifier type
45      * @param namespace
46      *            Namespace type
47      * @param identifier
48      *            Identifier of element.
49      * @return Value if present, null otherwise.
50      */
51     //<K, V, N extends IdentifierNamespace<? super K, ? extends V>> V
52     @Nullable
53     <K,V,N extends IdentifierNamespace<K, V>> V get(@Nonnull Class<N> namespace,@Nonnull  K identifier);
54
55     /**
56      * Returns all local values from supplied namespace.
57      *
58      * @param <K>
59      *            Identifier type
60      * @param <V>
61      *            Value type
62      * @param <N>
63      *            Namespace identifier type
64      * @param namespace
65      *            Namespace type
66      * @return Value if present, null otherwise.
67      */
68     @Nullable
69     <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAll(@Nonnull Class<N> namespace);
70
71     /**
72      * Returns a collection of all effective substatements.
73      *
74      * @return collection of all effective substatements.
75      */
76     @Nonnull Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements();
77 }