Select copyPolicy for each StatementSupport class
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / type / AbstractLeafrefSpecificationSupport.java
index 6fdc3b41263f9efee2991392ef78dcaaddc6f3c6..c893b03613c0bd3098edbd4235463a4c53e1f543 100644 (file)
@@ -25,7 +25,7 @@ import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 abstract class AbstractLeafrefSpecificationSupport
         extends BaseStatementSupport<String, LeafrefSpecification, EffectiveStatement<String, LeafrefSpecification>> {
     AbstractLeafrefSpecificationSupport() {
-        super(YangStmtMapping.TYPE);
+        super(YangStmtMapping.TYPE, CopyPolicy.DECLARED_COPY);
     }
 
     @Override
@@ -36,7 +36,7 @@ abstract class AbstractLeafrefSpecificationSupport
     @Override
     protected final LeafrefSpecification createDeclared(final StmtContext<String, LeafrefSpecification, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return new LeafrefSpecificationImpl(ctx.coerceRawStatementArgument(), substatements);
+        return new LeafrefSpecificationImpl(ctx.getRawArgument(), substatements);
     }
 
     @Override
@@ -52,7 +52,7 @@ abstract class AbstractLeafrefSpecificationSupport
             throw noPath(stmt);
         }
 
-        final LeafrefTypeBuilder builder = BaseTypes.leafrefTypeBuilder(stmt.getSchemaPath());
+        final LeafrefTypeBuilder builder = BaseTypes.leafrefTypeBuilder(stmt.wrapSchemaPath());
 
         for (final EffectiveStatement<?, ?> subStmt : substatements) {
             if (subStmt instanceof PathEffectiveStatement) {
@@ -72,6 +72,6 @@ abstract class AbstractLeafrefSpecificationSupport
          *     When the type is "union", the "type" statement (Section 7.4) MUST be
          *     present.
          */
-        return new SourceException("A path statement has to be present", stmt.sourceReference());
+        return new SourceException("A path statement has to be present", stmt);
     }
 }
\ No newline at end of file