Sonar: remove unused modifiers
[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.List;
11 import java.util.Map;
12 import org.opendaylight.yangtools.yang.common.QNameModule;
13 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
14 import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
15 import java.util.Collection;
16 import javax.annotation.Nonnull;
17 import javax.annotation.Nullable;
18 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
19 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
20 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
21 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
22 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
23 import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
24
25 public interface StmtContext<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>> {
26
27     @Nonnull
28     StatementSource getStatementSource();
29
30     @Nonnull
31     StatementSourceReference getStatementSourceReference();
32
33     @Nonnull
34     StatementDefinition getPublicDefinition();
35
36     @Nullable
37     StmtContext<?, ?, ?> getParentContext();
38
39     @Nullable
40     String rawStatementArgument();
41
42     @Nullable
43     A getStatementArgument();
44
45     @Nullable
46     List<Object> getArgumentsFromRoot();
47
48     // <K,VT, V extends VT,N extends IdentifierNamespace<K, V>>
49     // <K, VT, V extends VT ,N extends IdentifierNamespace<K, V>> VT
50     // getFromNamespace(Class<N> type, K key)
51     @Nonnull
52     <K, V, N extends IdentifierNamespace<K, V>> V getFromNamespace(
53             Class<N> type, K key) throws NamespaceNotAvailableException;
54
55     <K, V, N extends IdentifierNamespace<K, V>> Map<?, ?> getAllFromNamespace(
56             Class<N> type);
57
58     @Nonnull
59     StmtContext<?, ?, ?> getRoot();
60
61     @Nonnull
62     Collection<StatementContextBase<?, ?, ?>> declaredSubstatements();
63
64     Collection<StatementContextBase<?, ?, ?>> effectiveSubstatements();
65
66     D buildDeclared();
67
68     E buildEffective();
69
70     StatementContextBase<?, ?, ?> createCopy(QNameModule newQNameModule,
71             StatementContextBase<?, ?, ?> newParent, TypeOfCopy typeOfCopy)
72             throws SourceException;
73
74     public static enum TypeOfCopy {
75         ORIGINAL, ADDED_BY_USES, ADDED_BY_AUGMENTATION
76     }
77
78     TypeOfCopy getTypeOfCopy();
79
80     void setTypeOfCopy(TypeOfCopy typeOfCopy);
81
82     StatementContextBase<?, ?, ?> getOriginalCtx();
83
84     void setOriginalCtx(StatementContextBase<?, ?, ?> originalCtx);
85
86     boolean isRootContext();
87
88     void setCompletedPhase(ModelProcessingPhase completedPhase);
89
90     ModelProcessingPhase getCompletedPhase();
91
92     interface Mutable<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>>
93             extends StmtContext<A, D, E> {
94
95         @Override
96         StmtContext.Mutable<?, ?, ?> getParentContext();
97
98         // <K,V,VT extends V,N extends IdentifierNamespace<K, V>> void
99         // addToNs(Class<N> type, K key, VT value)
100         <K, V, VT extends V, N extends IdentifierNamespace<K, V>> void addToNs(
101                 Class<N> type, K key, VT value)
102                 throws NamespaceNotAvailableException;
103
104         @Override
105         StmtContext.Mutable<?, ?, ?> getRoot();
106
107         ModelActionBuilder newInferenceAction(ModelProcessingPhase phase);
108
109         <K, KT extends K, N extends StatementNamespace<K, ?, ?>> void addContext(
110                 Class<N> namespace, KT key, StmtContext<?, ?, ?> stmt);
111
112     }
113
114 }