import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
-
+import javax.annotation.Nonnull;
import org.opendaylight.yangtools.concepts.Identifiable;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
import org.opendaylight.yangtools.yang.model.repo.util.AbstractSchemaRepository;
/**
- * A {@link SchemaRepository} which allows sharing of {@link SchemaContext} as
- * long as their specification is the same.
+ * A {@link SchemaRepository} which allows sharing of {@link SchemaContext} as long as their specification is the same.
*
- * Note: for current implementation, "same" means the same filter and the same
- * set of {@link SourceIdentifier}s.
+ * <p>
+ * Note: for current implementation, "same" means the same filter and the same set of {@link SourceIdentifier}s.
*/
@Beta
public final class SharedSchemaRepository extends AbstractSchemaRepository implements Identifiable<String> {
private final LoadingCache<SchemaSourceFilter, SchemaContextFactory> cache =
CacheBuilder.newBuilder().softValues().build(new CacheLoader<SchemaSourceFilter, SchemaContextFactory>() {
@Override
- public SchemaContextFactory load(final SchemaSourceFilter key) {
+ public SchemaContextFactory load(@Nonnull final SchemaSourceFilter key) {
return new SharedSchemaContextFactory(SharedSchemaRepository.this, key);
}
});
}
@Override
- public SchemaContextFactory createSchemaContextFactory(final SchemaSourceFilter filter) {
+ public SchemaContextFactory createSchemaContextFactory(@Nonnull final SchemaSourceFilter filter) {
return cache.getUnchecked(filter);
}