import org.opendaylight.yangtools.yang.model.api.stmt.IdentityEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.IdentityStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement.IdentityRefSpecification;
-import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
-import org.opendaylight.yangtools.yang.model.util.type.IdentityrefTypeBuilder;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStatementSupport;
+import org.opendaylight.yangtools.yang.model.ri.type.BaseTypes;
+import org.opendaylight.yangtools.yang.model.ri.type.IdentityrefTypeBuilder;
import org.opendaylight.yangtools.yang.parser.spi.IdentityNamespace;
+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.InferenceException;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
abstract class AbstractIdentityRefSpecificationSupport
- extends BaseStatementSupport<String, IdentityRefSpecification,
+ extends AbstractStringStatementSupport<IdentityRefSpecification,
EffectiveStatement<String, IdentityRefSpecification>> {
AbstractIdentityRefSpecificationSupport() {
- super(YangStmtMapping.TYPE);
- }
-
- @Override
- public final String parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
- return value;
+ super(YangStmtMapping.TYPE, StatementPolicy.exactReplica());
}
@Override
final Collection<StmtContext<QName, BaseStatement, ?>> baseStatements =
StmtContextUtils.findAllDeclaredSubstatements(stmt, BaseStatement.class);
for (StmtContext<QName, BaseStatement, ?> baseStmt : baseStatements) {
- final QName baseIdentity = baseStmt.coerceStatementArgument();
+ final QName baseIdentity = baseStmt.getArgument();
final StmtContext<?, ?, ?> stmtCtx = stmt.getFromNamespace(IdentityNamespace.class, baseIdentity);
- InferenceException.throwIfNull(stmtCtx, stmt.sourceReference(),
+ InferenceException.throwIfNull(stmtCtx, stmt,
"Referenced base identity '%s' doesn't exist in given scope (module, imported modules, submodules)",
- baseIdentity.getLocalName());
+ baseIdentity.getLocalName());
}
}
throw noBase(stmt);
}
- final IdentityrefTypeBuilder builder = BaseTypes.identityrefTypeBuilder(stmt.getSchemaPath());
+ final IdentityrefTypeBuilder builder = BaseTypes.identityrefTypeBuilder(stmt.argumentAsTypeQName());
for (final EffectiveStatement<?, ?> subStmt : substatements) {
if (subStmt instanceof BaseEffectiveStatement) {
final QName identityQName = ((BaseEffectiveStatement) subStmt).argument();
* statement, MUST be present at least once if the type is
* "identityref".
*/
- return new SourceException("At least one base statement has to be present", stmt.sourceReference());
+ return new SourceException("At least one base statement has to be present", stmt);
}
}
\ No newline at end of file