Bug 6868: If-feature argument may be boolean expression
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / repo / api / SchemaContextFactory.java
index eaa06ce6ad8b71e1427b80ea9d4bc6feee81b12f..91dfc946f4c004df57ed157ba93c3e04d8b02c06 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.yangtools.yang.model.repo.api;
 import com.google.common.annotations.Beta;
 import com.google.common.util.concurrent.CheckedFuture;
 import java.util.Collection;
-import java.util.function.Predicate;
+import java.util.Set;
 import javax.annotation.Nonnull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -33,8 +33,8 @@ public interface SchemaContextFactory {
      *         failed.
      */
     default CheckedFuture<SchemaContext, SchemaResolutionException> createSchemaContext(
-            @Nonnull Collection<SourceIdentifier> requiredSources) {
-        return createSchemaContext(requiredSources, StatementParserMode.DEFAULT_MODE, IfFeaturePredicates.ALL_FEATURES);
+            @Nonnull final Collection<SourceIdentifier> requiredSources) {
+        return createSchemaContext(requiredSources, StatementParserMode.DEFAULT_MODE);
     }
 
     /**
@@ -50,8 +50,8 @@ public interface SchemaContextFactory {
      *         failed.
      */
     default CheckedFuture<SchemaContext, SchemaResolutionException> createSchemaContext(
-            Collection<SourceIdentifier> requiredSources, StatementParserMode statementParserMode) {
-        return createSchemaContext(requiredSources, statementParserMode, IfFeaturePredicates.ALL_FEATURES);
+            final Collection<SourceIdentifier> requiredSources, final StatementParserMode statementParserMode) {
+        return createSchemaContext(requiredSources, statementParserMode, null);
     }
 
     /**
@@ -60,16 +60,16 @@ public interface SchemaContextFactory {
      *
      * @param requiredSources
      *            a collection of sources which are required to be present
-     * @param isFeatureSupported
-     *            a predicate based on which all if-feature statements in the
+     * @param supportedFeatures
+     *            set of supported features based on which all if-feature statements in the
      *            parsed yang models are resolved
      * @return A checked future, which will produce a schema context, or fail
      *         with an explanation why the creation of the schema context
      *         failed.
      */
     default CheckedFuture<SchemaContext, SchemaResolutionException> createSchemaContext(
-            @Nonnull Collection<SourceIdentifier> requiredSources, Predicate<QName> isFeatureSupported) {
-        return createSchemaContext(requiredSources, StatementParserMode.DEFAULT_MODE, isFeatureSupported);
+            @Nonnull final Collection<SourceIdentifier> requiredSources, final Set<QName> supportedFeatures) {
+        return createSchemaContext(requiredSources, StatementParserMode.DEFAULT_MODE, supportedFeatures);
     }
 
     /**
@@ -80,8 +80,8 @@ public interface SchemaContextFactory {
      *            a collection of sources which are required to be present
      * @param statementParserMode
      *            mode of statement parser
-     * @param isFeatureSupported
-     *            a predicate based on which all if-feature statements in the
+     * @param supportedFeatures
+     *            set of supported features based on which all if-feature statements in the
      *            parsed yang models are resolved
      * @return A checked future, which will produce a schema context, or fail
      *         with an explanation why the creation of the schema context
@@ -89,5 +89,5 @@ public interface SchemaContextFactory {
      */
     CheckedFuture<SchemaContext, SchemaResolutionException> createSchemaContext(
             Collection<SourceIdentifier> requiredSources, StatementParserMode statementParserMode,
-            Predicate<QName> isFeatureSupported);
+            Set<QName> supportedFeatures);
 }