Reformulate StatementContextFactory.createEffective()
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / organization / OrganizationStatementSupport.java
index b78e2622e5c9e4494f48ddb92ff9c9cb9d57b256..c324ca29c5315910bc8201e75d6afc8ce6e84864 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
+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;
 
@@ -49,17 +50,9 @@ public final class OrganizationStatementSupport
     }
 
     @Override
-    protected OrganizationEffectiveStatement createEffective(
-            final StmtContext<String, OrganizationStatement, OrganizationEffectiveStatement> ctx,
-            final OrganizationStatement declared,
+    protected OrganizationEffectiveStatement createEffective(final Current<String, OrganizationStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return new RegularOrganizationEffectiveStatement(declared, substatements);
-    }
-
-    @Override
-    protected OrganizationEffectiveStatement createEmptyEffective(
-            final StmtContext<String, OrganizationStatement, OrganizationEffectiveStatement> ctx,
-            final OrganizationStatement declared) {
-        return new EmptyOrganizationEffectiveStatement(declared);
+        return substatements.isEmpty() ? new EmptyOrganizationEffectiveStatement(stmt.declared())
+            : new RegularOrganizationEffectiveStatement(stmt.declared(), substatements);
     }
 }
\ No newline at end of file