Further cleanups of code
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / ReferenceStatementImpl.java
index 675f8bd5413ac170242103d7cc46c395c67b9ae0..ed29d8617c9431417d9c33e54f7e571cc83f0df5 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -11,12 +11,16 @@ import javax.annotation.Nonnull;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
+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.stmt.rfc6020.effective.ReferenceEffectiveStatementImpl;
 
 public class ReferenceStatementImpl extends AbstractDeclaredStatement<String> implements ReferenceStatement {
+    private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(Rfc6020Mapping
+            .REFERENCE)
+            .build();
 
     protected ReferenceStatementImpl(final StmtContext<String, ReferenceStatement, ?> context) {
         super(context);
@@ -43,6 +47,13 @@ public class ReferenceStatementImpl extends AbstractDeclaredStatement<String> im
                 final StmtContext<String, ReferenceStatement, EffectiveStatement<String, ReferenceStatement>> ctx) {
             return new ReferenceEffectiveStatementImpl(ctx);
         }
+
+        @Override
+        public void onFullDefinitionDeclared(StmtContext.Mutable<String, ReferenceStatement,
+                EffectiveStatement<String, ReferenceStatement>> stmt) {
+            super.onFullDefinitionDeclared(stmt);
+            SUBSTATEMENT_VALIDATOR.validate(stmt);
+        }
     }
 
     @Nonnull @Override