*/
package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
-import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
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.model.api.stmt.TypeStatement.NumericalRestrictions;
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;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.NumericalRestrictionsEffectiveStatementImpl;
-public class NumericalRestrictionsImpl extends AbstractDeclaredStatement<String> implements
- TypeStatement.NumericalRestrictions {
+public class NumericalRestrictionsImpl extends AbstractDeclaredStatement<String> implements NumericalRestrictions {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
+ .TYPE)
+ .addMandatory(YangStmtMapping.RANGE)
+ .build();
- protected NumericalRestrictionsImpl(StmtContext<String, TypeStatement.NumericalRestrictions, ?> context) {
+ protected NumericalRestrictionsImpl(final StmtContext<String, NumericalRestrictions, ?> context) {
super(context);
}
- public static class Definition
- extends
- AbstractStatementSupport<String, TypeStatement.NumericalRestrictions, EffectiveStatement<String, TypeStatement.NumericalRestrictions>> {
+ public static class Definition extends
+ AbstractStatementSupport<String, NumericalRestrictions, EffectiveStatement<String, NumericalRestrictions>> {
public Definition() {
- super(Rfc6020Mapping.TYPE);
+ super(YangStmtMapping.TYPE);
}
@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) {
+ public NumericalRestrictions createDeclared(final StmtContext<String, NumericalRestrictions, ?> ctx) {
return new NumericalRestrictionsImpl(ctx);
}
@Override
- public EffectiveStatement<String, TypeStatement.NumericalRestrictions> createEffective(
- StmtContext<String, TypeStatement.NumericalRestrictions, EffectiveStatement<String, TypeStatement.NumericalRestrictions>> ctx) {
+ public EffectiveStatement<String, NumericalRestrictions> createEffective(
+ final StmtContext<String, NumericalRestrictions, EffectiveStatement<String, NumericalRestrictions>> ctx) {
return new NumericalRestrictionsEffectiveStatementImpl(ctx);
}
+
+ @Override
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
+ }
}
+ @Nonnull
@Override
public String getName() {
return argument();
}
+ @Nonnull
@Override
public RangeStatement getRange() {
return firstDeclared(RangeStatement.class);
}
-}
\ No newline at end of file
+}