Merge "Introduced skeletons of Contributor and User guide."
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / spi / meta / StmtContext.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.parser.spi.meta;
9
10 import java.util.Collection;
11 import javax.annotation.Nonnull;
12 import javax.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
14 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
15 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
16 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
17 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
18 import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
19
20
21 public interface StmtContext<A,D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>> {
22
23     @Nonnull StatementSource getStatementSource();
24
25     @Nonnull StatementSourceReference getStatementSourceReference();
26
27     @Nonnull StatementDefinition getPublicDefinition();
28
29     @Nullable StmtContext<?,?,?> getParentContext();
30
31     @Nullable String rawStatementArgument();
32
33     @Nullable A getStatementArgument();
34
35     @Nonnull <K,VT, V extends VT,N extends IdentifierNamespace<K, V>> VT getFromNamespace(Class<N> type, K key) throws NamespaceNotAvailableException;
36
37     @Nonnull StmtContext<?,?,?> getRoot();
38
39     @Nonnull Collection<? extends StmtContext<?,?,?>> declaredSubstatements();
40
41     D buildDeclared();
42
43     E buildEffective();
44
45     interface Mutable<A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A, D>> extends StmtContext<A,D,E> {
46
47         @Override
48         StmtContext.Mutable<?,?,?> getParentContext();
49
50         <K,V,VT extends V,N extends IdentifierNamespace<K, V>> void addToNs(Class<N> type, K key, VT value) throws NamespaceNotAvailableException;
51
52         @Override
53         StmtContext.Mutable<?,?,?> getRoot();
54
55         ModelActionBuilder newInferenceAction(ModelProcessingPhase phase);
56
57         <K,KT extends K, N extends StatementNamespace<K, ?, ?>> void addContext(Class<N> namepsace, KT key,
58                 StmtContext<?, ?, ?> stmt);
59
60     }
61
62
63
64 }