2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/eplv10.html
8 package org.opendaylight.yangtools.yang.model.repo.api;
10 import com.google.common.collect.ImmutableList;
11 import com.google.common.collect.ImmutableList.Builder;
12 import com.google.common.util.concurrent.Futures;
13 import com.google.common.util.concurrent.ListenableFuture;
16 * A {@link SchemaSourceFilter} which accepts any schema source it is presented with.
18 public final class AcceptingSchemaSourceFilter implements SchemaSourceFilter {
19 private static final AcceptingSchemaSourceFilter INSTANCE = new AcceptingSchemaSourceFilter();
21 private final Iterable<Class<? extends SchemaSourceRepresentation>> representations;
23 private AcceptingSchemaSourceFilter() {
24 final Builder<Class<? extends SchemaSourceRepresentation>> b = ImmutableList.builder();
25 b.add(SchemaSourceRepresentation.class);
26 representations = b.build();
30 * Return the singleton instance of this filter.
32 * @return Singleton shared instance.
34 public static final AcceptingSchemaSourceFilter getSingletonInstance() {
39 public Iterable<Class<? extends SchemaSourceRepresentation>> supportedRepresentations() {
40 return representations;
44 public ListenableFuture<Boolean> apply(final SchemaSourceRepresentation schemaSource) {
45 return Futures.immediateFuture(Boolean.TRUE);