import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RangeStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
public class NumericalRestrictionsImpl extends AbstractDeclaredStatement<String> implements
TypeStatement.NumericalRestrictions {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(Rfc6020Mapping
+ .TYPE)
+ .add(Rfc6020Mapping.RANGE, 1, 1)
+ .build();
- protected NumericalRestrictionsImpl(StmtContext<String, TypeStatement.NumericalRestrictions, ?> context) {
+ protected NumericalRestrictionsImpl(final StmtContext<String, TypeStatement.NumericalRestrictions, ?> context) {
super(context);
}
- public static class Definition
- extends
+ public static class Definition extends
AbstractStatementSupport<String, TypeStatement.NumericalRestrictions, EffectiveStatement<String, TypeStatement.NumericalRestrictions>> {
public Definition() {
}
@Override
- public String parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) throws SourceException {
+ public String parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
return value;
}
@Override
public TypeStatement.NumericalRestrictions createDeclared(
- StmtContext<String, TypeStatement.NumericalRestrictions, ?> ctx) {
+ final StmtContext<String, TypeStatement.NumericalRestrictions, ?> ctx) {
return new NumericalRestrictionsImpl(ctx);
}
@Override
public EffectiveStatement<String, TypeStatement.NumericalRestrictions> createEffective(
- StmtContext<String, TypeStatement.NumericalRestrictions, EffectiveStatement<String, TypeStatement.NumericalRestrictions>> ctx) {
+ final StmtContext<String, TypeStatement.NumericalRestrictions, EffectiveStatement<String, TypeStatement.NumericalRestrictions>> ctx) {
return new NumericalRestrictionsEffectiveStatementImpl(ctx);
}
+
+ @Override
+ public void onFullDefinitionDeclared(StmtContext.Mutable<String, NumericalRestrictions,
+ EffectiveStatement<String, NumericalRestrictions>> stmt) throws SourceException {
+ super.onFullDefinitionDeclared(stmt);
+ SUBSTATEMENT_VALIDATOR.validate(stmt);
+ }
}
@Override