import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
import org.opendaylight.yangtools.yang.model.util.type.DecimalTypeBuilder;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStatementSupport;
+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.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
final class Decimal64SpecificationSupport extends BaseStatementSupport<String, Decimal64Specification,
EffectiveStatement<String, Decimal64Specification>> {
@Override
protected Decimal64Specification createEmptyDeclared(final StmtContext<String, Decimal64Specification, ?> ctx) {
- throw noFracDigits(ctx.getStatementSourceReference());
+ throw noFracDigits(ctx);
}
@Override
final Current<String, Decimal64Specification> stmt,
final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
if (substatements.isEmpty()) {
- throw noFracDigits(stmt.sourceReference());
+ throw noFracDigits(stmt);
}
final DecimalTypeBuilder builder = BaseTypes.decimalTypeBuilder(stmt.getSchemaPath());
return new TypeEffectiveStatementImpl<>(stmt.declared(), substatements, builder);
}
- private static SourceException noFracDigits(final StatementSourceReference ref) {
+ private static SourceException noFracDigits(final CommonStmtCtx stmt) {
/*
* https://tools.ietf.org/html/rfc7950#section-9.3.4
*
* The "fraction-digits" statement, which is a substatement to the
* "type" statement, MUST be present if the type is "decimal64".
*/
- return new SourceException("At least one fraction-digits statement has to be present", ref);
+ return new SourceException("At least one fraction-digits statement has to be present", stmt.sourceReference());
}
}
\ No newline at end of file