Search in sources :

Example 1 with BiMapYangNamespaceContext

use of org.opendaylight.yangtools.yang.common.BiMapYangNamespaceContext in project yangtools by opendaylight.

the class ModuleNameNamespaceContext method toBiMap.

/**
 * Convert this object to an equivalent {@link BiMapYangNamespaceContext}.
 *
 * @return A BiMapYangNamespaceContext.
 */
public BiMapYangNamespaceContext toBiMap() {
    final Builder<String, QNameModule> builder = ImmutableBiMap.builder();
    for (ModuleEffectiveStatement module : getEffectiveModelContext().getModuleStatements().values()) {
        final String name = module.argument().getLocalName();
        builder.put(name, findNamespaceForPrefix(name).get());
    }
    return new BiMapYangNamespaceContext(builder.build());
}
Also used : QNameModule(org.opendaylight.yangtools.yang.common.QNameModule) ModuleEffectiveStatement(org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement) BiMapYangNamespaceContext(org.opendaylight.yangtools.yang.common.BiMapYangNamespaceContext)

Aggregations

BiMapYangNamespaceContext (org.opendaylight.yangtools.yang.common.BiMapYangNamespaceContext)1 QNameModule (org.opendaylight.yangtools.yang.common.QNameModule)1 ModuleEffectiveStatement (org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement)1