org.opendaylight.yangtools.yang.model.api.Module.getSubmodules()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.opendaylight.yangtools.yang.model.api.Module.getSubmodules()方法的一些代码示例,展示了Module.getSubmodules()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.getSubmodules()方法的具体详情如下:
包路径:org.opendaylight.yangtools.yang.model.api.Module
类名称:Module
方法名:getSubmodules

Module.getSubmodules介绍

暂无

代码示例

代码示例来源:origin: opendaylight/yangtools

private static Collection<ModuleImport> allImports(final Module mod) {
  if (mod.getSubmodules().isEmpty()) {
    return mod.getImports();
  }
  final Collection<ModuleImport> concat = new LinkedHashSet<>();
  concat.addAll(mod.getImports());
  for (Module sub : mod.getSubmodules()) {
    concat.addAll(sub.getImports());
  }
  return concat;
}

代码示例来源:origin: org.opendaylight.yangtools/yang-model-util

private static Collection<ModuleImport> allImports(final Module mod) {
  if (mod.getSubmodules().isEmpty()) {
    return mod.getImports();
  }
  final Collection<ModuleImport> concat = new LinkedHashSet<>();
  concat.addAll(mod.getImports());
  for (Module sub : mod.getSubmodules()) {
    concat.addAll(sub.getImports());
  }
  return concat;
}

代码示例来源:origin: org.opendaylight.controller/config-netconf-connector

@Override
public Set<Module> getModules() {
  final Set<Module> modules = Sets.newHashSet(schemaContext.getModules());
  for (final Module module : schemaContext.getModules()) {
    modules.addAll(module.getSubmodules());
  }
  return modules;
}

代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector

static Set<Capability> transformCapabilities(final SchemaContext currentContext, final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProviderDependency) {
    final Set<Capability> capabilities = new HashSet<>();

    // Added by netconf-impl by default
//        capabilities.add(new BasicCapability("urn:ietf:params:netconf:capability:candidate:1.0"));

    final Set<Module> modules = currentContext.getModules();
    for (final Module module : modules) {
      Optional<YangModuleCapability> cap = moduleToCapability(module, rootSchemaSourceProviderDependency);
      if(cap.isPresent()) {
        capabilities.add(cap.get());
      }
      for (final Module submodule : module.getSubmodules()) {
        cap = moduleToCapability(submodule, rootSchemaSourceProviderDependency);
        if(cap.isPresent()) {
          capabilities.add(cap.get());
        }
      }
    }

    return capabilities;
  }

代码示例来源:origin: org.opendaylight.controller/mdsal-netconf-connector

static Set<Capability> transformCapabilities(final SchemaContext currentContext) {
  final Set<Capability> capabilities = new HashSet<>();
  // [RFC6241] 8.3.  Candidate Configuration Capability
  capabilities.add(new BasicCapability("urn:ietf:params:netconf:capability:candidate:1.0"));
  final Set<Module> modules = currentContext.getModules();
  for (final Module module : modules) {
    Optional<YangModuleCapability> cap = moduleToCapability(module);
    if(cap.isPresent()) {
      capabilities.add(cap.get());
    }
    for (final Module submodule : module.getSubmodules()) {
      cap = moduleToCapability(submodule);
      if(cap.isPresent()) {
        capabilities.add(cap.get());
      }
    }
  }
  return capabilities;
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Extract the identifiers of all modules and submodules which were used to create a particular SchemaContext.
 *
 * @param context SchemaContext to be examined
 * @return Set of ModuleIdentifiers.
 */
public static Set<SourceIdentifier> getConstituentModuleIdentifiers(final SchemaContext context) {
  final Set<SourceIdentifier> ret = new HashSet<>();
  for (Module module : context.getModules()) {
    ret.add(moduleToIdentifier(module));
    for (Module submodule : module.getSubmodules()) {
      ret.add(moduleToIdentifier(submodule));
    }
  }
  return ret;
}

代码示例来源:origin: org.opendaylight.yangtools/yang-model-util

/**
 * Extract the identifiers of all modules and submodules which were used to create a particular SchemaContext.
 *
 * @param context SchemaContext to be examined
 * @return Set of ModuleIdentifiers.
 */
public static Set<SourceIdentifier> getConstituentModuleIdentifiers(final SchemaContext context) {
  final Set<SourceIdentifier> ret = new HashSet<>();
  for (Module module : context.getModules()) {
    ret.add(moduleToIdentifier(module));
    for (Module submodule : module.getSubmodules()) {
      ret.add(moduleToIdentifier(submodule));
    }
  }
  return ret;
}

代码示例来源:origin: opendaylight/yangtools

ContextHolder toContext() throws IOException, YangParserException {
  for (YangTextSchemaSource source : toUniqueSources(dependencies)) {
    // This source is coming from a dependency:
    // - its identifier should be accurate, as it should have been processed into a file with accurate name
    // - it is not required to be parsed, hence we add it just as a library source
    parser.addLibSource(source);
  }
  final SchemaContext schemaContext = Verify.verifyNotNull(parser.buildSchemaContext());
  final Set<Module> modules = new HashSet<>();
  for (Module module : schemaContext.getModules()) {
    final SourceIdentifier modId = Util.moduleToIdentifier(module);
    LOG.debug("Looking for source {}", modId);
    if (modelsInProject.containsKey(modId)) {
      LOG.debug("Module {} belongs to current project", module);
      modules.add(module);
      for (Module sub : module.getSubmodules()) {
        final SourceIdentifier subId = Util.moduleToIdentifier(sub);
        if (!modelsInProject.containsKey(subId)) {
          LOG.warn("Submodule {} not found in input files", sub);
        }
      }
    }
  }
  return new ContextHolder(schemaContext, modules, modelsInProject.keySet());
}

代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-yang-library

private Submodules createSubmodulesForModule(final Module module) {
    final List<Submodule> submodulesList = Lists.newArrayList();
    for (final Module subModule : module.getSubmodules()) {
      final SubmoduleBuilder subModuleEntryBuilder = new SubmoduleBuilder();
      subModuleEntryBuilder.setName(new YangIdentifier(subModule.getName()))
          .setRevision(new OptionalRevision(SimpleDateFormatUtil.getRevisionFormat().format(subModule.getRevision())));
      submodulesList.add(subModuleEntryBuilder.build());
    }

    return  new SubmodulesBuilder().setSubmodule(submodulesList).build();
  }
}

代码示例来源:origin: opendaylight/yangtools

private boolean checkModuleDependency(final Module module, final Collection<ModuleId> rootModules) {
  for (ModuleId rootModule : rootModules) {
    if (rootModule.equals(new ModuleId(module.getName(), module.getRevision()))) {
      return true;
    }
    //handling/checking imports regarding root modules
    for (ModuleImport moduleImport : module.getImports()) {
      if (moduleImport.getModuleName().equals(rootModule.getName())) {
        return !moduleImport.getRevision().isPresent()
            || moduleImport.getRevision().equals(rootModule.getRev());
      }
    }
    //submodules handling
    for (Module moduleSub : module.getSubmodules()) {
      return checkModuleDependency(moduleSub, rootModules);
    }
  }
  return false;
}

代码示例来源:origin: org.opendaylight.yangtools/yang-model-util

private boolean checkModuleDependency(final Module module, final Collection<ModuleId> rootModules) {
  for (ModuleId rootModule : rootModules) {
    if (rootModule.equals(new ModuleId(module.getName(), module.getRevision()))) {
      return true;
    }
    //handling/checking imports regarding root modules
    for (ModuleImport moduleImport : module.getImports()) {
      if (moduleImport.getModuleName().equals(rootModule.getName())) {
        return !moduleImport.getRevision().isPresent()
            || moduleImport.getRevision().equals(rootModule.getRev());
      }
    }
    //submodules handling
    for (Module moduleSub : module.getSubmodules()) {
      return checkModuleDependency(moduleSub, rootModules);
    }
  }
  return false;
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-java-api-generator

_builder.newLineIfNotEmpty();
 if (((!m.getImports().isEmpty()) || (!m.getSubmodules().isEmpty()))) {
  _builder.append("    ");
  String _importedName = this.importedName(Set.class);
 boolean _isEmpty_1 = m.getSubmodules().isEmpty();
 boolean _not_2 = (!_isEmpty_1);
 if (_not_2) {
   Set<org.opendaylight.yangtools.yang.model.api.Module> _submodules = m.getSubmodules();
   for(final org.opendaylight.yangtools.yang.model.api.Module submodule : _submodules) {
    _builder.append("    ");
 if ((m.getImports().isEmpty() && m.getSubmodules().isEmpty())) {
  _builder.append("    ");
  _builder.append("importedModules = ");

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-java-api-generator

private CharSequence generateSubInfo(final org.opendaylight.yangtools.yang.model.api.Module module) {
 StringConcatenation _builder = new StringConcatenation();
  Set<org.opendaylight.yangtools.yang.model.api.Module> _submodules = module.getSubmodules();
  for(final org.opendaylight.yangtools.yang.model.api.Module submodule : _submodules) {
   final String className = BindingMapping.getClassName(submodule.getName());

代码示例来源:origin: org.opendaylight.yangtools/binding-java-api-generator

private CharSequence generateSubInfo(final Module module) {
 StringConcatenation _builder = new StringConcatenation();
  Set<Module> _submodules = module.getSubmodules();
  for(final Module submodule : _submodules) {
   _builder.append("private static final class ");

代码示例来源:origin: org.opendaylight.yangtools/binding-java-api-generator

_or = true;
} else {
 Set<Module> _submodules = m.getSubmodules();
 boolean _isEmpty_1 = _submodules.isEmpty();
 boolean _not_1 = (!_isEmpty_1);
Set<Module> _submodules_1 = m.getSubmodules();
boolean _isEmpty_3 = _submodules_1.isEmpty();
boolean _not_3 = (!_isEmpty_3);
if (_not_3) {
  Set<Module> _submodules_2 = m.getSubmodules();
  for(final Module submodule : _submodules_2) {
   _builder.append("    ");
 _and = false;
} else {
 Set<Module> _submodules_3 = m.getSubmodules();
 boolean _isEmpty_5 = _submodules_3.isEmpty();
 _and = _isEmpty_5;

相关文章