Convert trivial CopyPolicy users to StatementPolicy
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / BaseBooleanStatementSupport.java
index d85c658ce1b3689c740070d17bda8775d66d3c43..0b2597f9586c5a9813f9d156e44146f03cc7f149 100644 (file)
@@ -19,7 +19,8 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
- * Specialization of {@link BaseStatementSupport} for Boolean statement arguments.
+ * Specialization of {@link BaseStatementSupport} for statements which carry a Boolean argument and are essentially
+ * context-independent.
  *
  * @param <D> Declared Statement representation
  * @param <E> Effective Statement representation
@@ -33,8 +34,8 @@ public abstract class BaseBooleanStatementSupport<D extends DeclaredStatement<Bo
     private final @NonNull D emptyDeclaredTrue;
 
     protected BaseBooleanStatementSupport(final StatementDefinition publicDefinition,
-            final E emptyEffectiveFalse, final E emptyEffectiveTrue) {
-        super(publicDefinition, CopyPolicy.CONTEXT_INDEPENDENT);
+            final E emptyEffectiveFalse, final E emptyEffectiveTrue, final StatementPolicy<Boolean, D> policy) {
+        super(publicDefinition, policy);
         this.emptyEffectiveFalse = requireNonNull(emptyEffectiveFalse);
         this.emptyEffectiveTrue = requireNonNull(emptyEffectiveTrue);
         emptyDeclaredFalse = requireNonNull(emptyEffectiveFalse.getDeclared());
@@ -53,7 +54,7 @@ public abstract class BaseBooleanStatementSupport<D extends DeclaredStatement<Bo
 
     @Override
     protected final D createEmptyDeclared(final StmtContext<Boolean, D, ?> ctx) {
-        return ctx.coerceStatementArgument() ? emptyDeclaredTrue : emptyDeclaredFalse;
+        return ctx.getArgument() ? emptyDeclaredTrue : emptyDeclaredFalse;
     }
 
     @Override