*/
package org.opendaylight.yangtools.yang.parser.spi.meta;
+import com.google.common.base.Optional;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
-import java.util.Collection;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
public interface StmtContext<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>> {
@Nullable
A getStatementArgument();
- @Nullable
- List<Object> getArgumentsFromRoot();
+ /**
+ * Return the {@link SchemaPath} of this statement. Not all statements have a SchemaPath, in which case
+ * {@link Optional#absent()} is returned.
+ *
+ * @return Optional SchemaPath
+ */
+ @Nonnull Optional<SchemaPath> getSchemaPath();
+
+ boolean isConfiguration();
- // <K,VT, V extends VT,N extends IdentifierNamespace<K, V>>
- // <K, VT, V extends VT ,N extends IdentifierNamespace<K, V>> VT
- // getFromNamespace(Class<N> type, K key)
@Nonnull
- <K, V, N extends IdentifierNamespace<K, V>> V getFromNamespace(
- Class<N> type, K key) throws NamespaceNotAvailableException;
+ <K, V, KT extends K, N extends IdentifierNamespace<K, V>> V getFromNamespace(
+ Class<N> type, KT key) throws NamespaceNotAvailableException;
- <K, V, N extends IdentifierNamespace<K, V>> Map<?, ?> getAllFromNamespace(
+ <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromNamespace(
Class<N> type);
+ <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromCurrentStmtCtxNamespace(Class<N> type);
+
@Nonnull
StmtContext<?, ?, ?> getRoot();
Collection<StatementContextBase<?, ?, ?>> effectiveSubstatements();
+ Collection<StatementContextBase<?, ?, ?>> substatements();
+
D buildDeclared();
E buildEffective();
+ boolean isSupportedToBuildEffective();
+
+ void setIsSupportedToBuildEffective(boolean isSupportedToBuild);
+
+ Collection<StatementContextBase<?, ?, ?>> getEffectOfStatement();
+
+ void addAsEffectOfStatement(StatementContextBase<?, ?, ?> ctx);
+
+ StatementContextBase<?, ?, ?> createCopy(
+ StatementContextBase<?, ?, ?> newParent, TypeOfCopy typeOfCopy)
+ throws SourceException;
+
StatementContextBase<?, ?, ?> createCopy(QNameModule newQNameModule,
StatementContextBase<?, ?, ?> newParent, TypeOfCopy typeOfCopy)
throws SourceException;
- public static enum TypeOfCopy {
- ORIGINAL, ADDED_BY_USES, ADDED_BY_AUGMENTATION
+ enum TypeOfCopy {
+ ORIGINAL, ADDED_BY_USES, ADDED_BY_AUGMENTATION, ADDED_BY_USES_AUGMENTATION
}
- TypeOfCopy getTypeOfCopy();
+ List<TypeOfCopy> getCopyHistory();
+
+ void addAllToCopyHistory(List<TypeOfCopy> typeOfCopyList);
- void setTypeOfCopy(TypeOfCopy typeOfCopy);
+ void addToCopyHistory(TypeOfCopy typeOfCopy);
StatementContextBase<?, ?, ?> getOriginalCtx();
boolean isRootContext();
+ void setOrder(int order);
+
+ int getOrder();
+
void setCompletedPhase(ModelProcessingPhase completedPhase);
ModelProcessingPhase getCompletedPhase();
@Override
StmtContext.Mutable<?, ?, ?> getParentContext();
- // <K,V,VT extends V,N extends IdentifierNamespace<K, V>> void
- // addToNs(Class<N> type, K key, VT value)
- <K, V, VT extends V, N extends IdentifierNamespace<K, V>> void addToNs(
- Class<N> type, K key, VT value)
+ <K, V, KT extends K, VT extends V, N extends IdentifierNamespace<K, V>> void addToNs(
+ Class<N> type, KT key, VT value)
throws NamespaceNotAvailableException;
@Override