Add yang-model-api tests
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / repo / api / SchemaSourceFilter.java
index 6da4ee301263ffbcb72c5200fdea0b54ee87c3da..4b2575ce006a43fb680d0a35cca0e9280e37aa38 100644 (file)
@@ -8,33 +8,33 @@
 package org.opendaylight.yangtools.yang.model.repo.api;
 
 import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.Futures;
+import com.google.common.collect.ImmutableList;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.ListenableFuture;
-import java.util.Collections;
+import org.opendaylight.yangtools.util.concurrent.FluentFutures;
 
 /**
- * A filter of schema sources. This is used to restrict which sources representation
- * instances are allowed to participate in construction of a schema context. This
- * allows, for example, to create an non-shared island, or require the sources to
- * be certified before use.
+ * A filter of schema sources. This is used to restrict which sources representation instances are allowed
+ * to participate in construction of a schema context. This allows, for example, to create an non-shared island,
+ * or require the sources to be certified before use.
  */
 @Beta
 public interface SchemaSourceFilter {
     /**
      * A {@link SchemaSourceFilter} which accepts any schema source it is presented with.
      */
-    public static final SchemaSourceFilter ALWAYS_ACCEPT = new SchemaSourceFilter() {
-        private final Iterable<Class<? extends SchemaSourceRepresentation>> REPRESENTATIONS =
-                Collections.<Class<? extends SchemaSourceRepresentation>>singletonList(SchemaSourceRepresentation.class);
+    SchemaSourceFilter ALWAYS_ACCEPT = new SchemaSourceFilter() {
+        private final Iterable<Class<? extends SchemaSourceRepresentation>> representations =
+                ImmutableList.of(SchemaSourceRepresentation.class);
 
         @Override
         public Iterable<Class<? extends SchemaSourceRepresentation>> supportedRepresentations() {
-            return REPRESENTATIONS;
+            return representations;
         }
 
         @Override
-        public ListenableFuture<Boolean> apply(final SchemaSourceRepresentation schemaSource) {
-            return Futures.immediateFuture(Boolean.TRUE);
+        public FluentFuture<Boolean> apply(final SchemaSourceRepresentation schemaSource) {
+            return FluentFutures.immediateTrueFluentFuture();
         }
     };
 
@@ -56,5 +56,6 @@ public interface SchemaSourceFilter {
      * @return Promise of a filtering decision. The result should be {@link Boolean#TRUE}
      *         if the source is acceptable.
      */
+    // FIXME: 3.0.0: require FluentFuture
     ListenableFuture<Boolean> apply(SchemaSourceRepresentation schemaSource);
 }