import static java.util.Objects.requireNonNull;
import java.net.URI;
+import java.util.Iterator;
import javax.annotation.Nonnull;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.data.api.codec.IdentityrefCodec;
@Override
protected String prefixForNamespace(@Nonnull final URI namespace) {
- final Module module = context.findModuleByNamespaceAndRevision(namespace, null);
- return module == null ? null : module.getName();
+ final Iterator<Module> modules = context.findModules(namespace).iterator();
+ return modules.hasNext() ? modules.next().getName() : null;
}
}