-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
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;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+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
+ 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 AbstractStatementSupport<String,TypeStatement.NumericalRestrictions,EffectiveStatement<String,TypeStatement.NumericalRestrictions>> {
+ public static class Definition extends
+ AbstractStatementSupport<String, TypeStatement.NumericalRestrictions, EffectiveStatement<String, TypeStatement.NumericalRestrictions>> {
public Definition() {
- super(Rfc6020Mapping.RANGE);
+ super(Rfc6020Mapping.TYPE);
}
- @Override public String parseArgumentValue(StmtContext<?, ?, ?> ctx,
- String value) throws SourceException {
+ @Override
+ public String parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
return value;
}
- @Override public TypeStatement.NumericalRestrictions createDeclared(
- StmtContext<String, TypeStatement.NumericalRestrictions, ?> ctx) {
+ @Override
+ public TypeStatement.NumericalRestrictions createDeclared(
+ 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) {
- throw new UnsupportedOperationException();
+ @Override
+ public EffectiveStatement<String, TypeStatement.NumericalRestrictions> createEffective(
+ 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
public RangeStatement getRange() {
- return firstDeclared(RangeStatement.class);
+ return firstDeclared(RangeStatement.class);
}
}
\ No newline at end of file