import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeEffectiveStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.ChildSchemaNodeNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.SchemaTreeNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
/**
- * Specialization of {@link BaseQNameStatementSupport} for stating the onStatementAdded method.
+ * Specialization of {@link BaseQNameStatementSupport} for {@link SchemaTreeEffectiveStatement} implementations. Every
+ * statement automatically participates in {@link SchemaTreeNamespace}.
*
* @param <D> Declared Statement representation
* @param <E> Effective Statement representation
*/
public abstract class BaseSchemaTreeStatementSupport<D extends DeclaredStatement<QName>,
E extends SchemaTreeEffectiveStatement<D>> extends BaseQNameStatementSupport<D, E> {
- protected BaseSchemaTreeStatementSupport(final StatementDefinition publicDefinition) {
- super(publicDefinition);
- }
-
protected BaseSchemaTreeStatementSupport(final StatementDefinition publicDefinition, final CopyPolicy copyPolicy) {
super(publicDefinition, copyPolicy);
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * This method ensures the statement is added to its parent {@link SchemaTreeNamespace}.
+ */
@Override
- public final void onStatementAdded(final Mutable<QName, D, E> stmt) {
- stmt.coerceParentContext().addToNs(ChildSchemaNodeNamespace.class, stmt.coerceStatementArgument(), stmt);
+ public void onStatementAdded(final Mutable<QName, D, E> stmt) {
+ stmt.coerceParentContext().addToNs(SchemaTreeNamespace.class, stmt.getArgument(), stmt);
}
// Non-final because {@code input} and {@code output} are doing their own thing.