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();
}
};
* @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);
}