All StatementSupports must support DeclarationReference
[yangtools.git] / yang / odlext-parser-support / src / main / java / org / opendaylight / yangtools / odlext / parser / ContextReferenceStatementSupport.java
index f7fc4dc870493abf2d26bf526efd20bf5b0601e7..4792cdca2227454812483281827d2cf8a8349a02 100644 (file)
@@ -9,23 +9,22 @@ package org.opendaylight.yangtools.odlext.parser;
 
 import com.google.common.annotations.Beta;
 import com.google.common.collect.ImmutableList;
-import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.odlext.model.api.ContextReferenceEffectiveStatement;
 import org.opendaylight.yangtools.odlext.model.api.ContextReferenceStatement;
 import org.opendaylight.yangtools.odlext.model.api.OpenDaylightExtensionsStatements;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclarationReference;
 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.stmt.IdentityEffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 @Beta
 public final class ContextReferenceStatementSupport
         extends AbstractIdentityAwareStatementSupport<ContextReferenceStatement, ContextReferenceEffectiveStatement> {
-    public static final @NonNull ContextReferenceStatementSupport INSTANCE = new ContextReferenceStatementSupport();
-
-    private ContextReferenceStatementSupport() {
-        super(OpenDaylightExtensionsStatements.CONTEXT_REFERENCE);
+    public ContextReferenceStatementSupport(final YangParserConfiguration config) {
+        super(OpenDaylightExtensionsStatements.CONTEXT_REFERENCE, config);
     }
 
     @Override
@@ -34,6 +33,12 @@ public final class ContextReferenceStatementSupport
         return new ContextReferenceStatementImpl(ctx.rawArgument(), ctx.getArgument(), substatements);
     }
 
+    @Override
+    protected ContextReferenceStatement attachDeclarationReference(final ContextReferenceStatement stmt,
+            final DeclarationReference reference) {
+        return new RefContextReferenceStatement(stmt, reference);
+    }
+
     @Override
     ContextReferenceEffectiveStatement createEffective(final ContextReferenceStatement declared,
             final IdentityEffectiveStatement identity,