import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement.LeafrefSpecification;
import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
import org.opendaylight.yangtools.yang.model.util.type.LeafrefTypeBuilder;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStatementSupport;
+import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.CommonStmtCtx;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-abstract class AbstractLeafrefSpecificationSupport
- extends BaseStatementSupport<String, LeafrefSpecification, EffectiveStatement<String, LeafrefSpecification>> {
+abstract class AbstractLeafrefSpecificationSupport extends AbstractStringStatementSupport<LeafrefSpecification,
+ EffectiveStatement<String, LeafrefSpecification>> {
AbstractLeafrefSpecificationSupport() {
- super(YangStmtMapping.TYPE);
- }
-
- @Override
- public final String parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
- return value;
+ super(YangStmtMapping.TYPE, StatementPolicy.exactReplica());
}
@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
throw noPath(stmt);
}
- final LeafrefTypeBuilder builder = BaseTypes.leafrefTypeBuilder(stmt.getSchemaPath());
+ final LeafrefTypeBuilder builder = BaseTypes.leafrefTypeBuilder(stmt.argumentAsTypeQName());
for (final EffectiveStatement<?, ?> subStmt : substatements) {
if (subStmt instanceof PathEffectiveStatement) {
* 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