2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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/epl-v10.html
8 package org.opendaylight.restconf.common.util;
10 import static com.google.common.base.Verify.verify;
12 import com.google.common.collect.ImmutableMap;
15 import java.util.function.Function;
16 import org.opendaylight.yangtools.yang.common.QNameModule;
17 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
18 import org.opendaylight.yangtools.yang.model.api.Module;
19 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement;
20 import org.opendaylight.yangtools.yang.model.spi.SimpleSchemaContext;
22 final class OperationsEffectiveModuleContext extends SimpleSchemaContext implements EffectiveModelContext {
23 private final Map<QNameModule, ModuleEffectiveStatement> modules;
25 OperationsEffectiveModuleContext(final Set<Module> modules) {
27 this.modules = modules.stream()
29 verify(module instanceof ModuleEffectiveStatement, "Module %s is not an effective statement");
30 return (ModuleEffectiveStatement) module;
32 .collect(ImmutableMap.toImmutableMap(ModuleEffectiveStatement::localQNameModule, Function.identity()));
36 public Map<QNameModule, ModuleEffectiveStatement> getModuleStatements() {