2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.parser.spi.meta;
10 import java.util.List;
13 import org.opendaylight.yangtools.yang.common.QNameModule;
14 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
15 import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
16 import java.util.Collection;
17 import javax.annotation.Nonnull;
18 import javax.annotation.Nullable;
19 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
20 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
21 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
22 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
23 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
24 import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
27 public interface StmtContext<A,D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>> {
29 @Nonnull StatementSource getStatementSource();
31 @Nonnull StatementSourceReference getStatementSourceReference();
33 @Nonnull StatementDefinition getPublicDefinition();
35 @Nullable StmtContext<?,?,?> getParentContext();
37 @Nullable String rawStatementArgument();
39 @Nullable A getStatementArgument();
41 @Nullable List<Object> getArgumentsFromRoot();
43 //<K,VT, V extends VT,N extends IdentifierNamespace<K, V>>
44 // <K, VT, V extends VT ,N extends IdentifierNamespace<K, V>> VT getFromNamespace(Class<N> type, K key)
45 @Nonnull <K,V,N extends IdentifierNamespace<K, V>> V getFromNamespace(Class<N> type, K key) throws NamespaceNotAvailableException;
47 <K, V, N extends IdentifierNamespace<K, V>> Map<?, ?> getAllFromNamespace(Class<N> type);
49 @Nonnull StmtContext<?,?,?> getRoot();
51 @Nonnull Collection<StatementContextBase<?,?,?>> declaredSubstatements();
53 public Collection<StatementContextBase<?, ?, ?>> effectiveSubstatements();
59 public StatementContextBase<?, ?, ?> createCopy(QNameModule newQNameModule,StatementContextBase<?, ?, ?> newParent) throws SourceException;
61 interface Mutable<A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A, D>> extends StmtContext<A,D,E> {
64 StmtContext.Mutable<?,?,?> getParentContext();
66 //<K,V,VT extends V,N extends IdentifierNamespace<K, V>> void addToNs(Class<N> type, K key, VT value)
67 <K,V,VT extends V,N extends IdentifierNamespace<K, V>> void addToNs(Class<N> type, K key, VT value) throws NamespaceNotAvailableException;
70 StmtContext.Mutable<?,?,?> getRoot();
72 ModelActionBuilder newInferenceAction(ModelProcessingPhase phase);
74 <K,KT extends K, N extends StatementNamespace<K, ?, ?>> void addContext(Class<N> namespace, KT key,
75 StmtContext<?, ?, ?> stmt);