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

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

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

Module.getName介绍

[英]Returns the name of the module which is specified as argument of YANG Module keyword.
[中]返回指定为模块关键字参数的模块名称。

代码示例

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

private static URI getModuleNamespace(final SchemaContext ctx, final String moduleName) {
  for (final Module module : ctx.getModules()) {
    if (moduleName.equals(module.getName())) {
      return module.getNamespace();
    }
  }
  throw new IllegalArgumentException("Module " + moduleName + "does not exists in provided schema context");
}

代码示例来源:origin: org.opendaylight.yangtools/yang-data-impl

@Override
@SuppressWarnings("checkstyle:parameterName")
public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
    final int charPositionInLine, final String msg, final RecognitionException e) {
  LOG.debug("Syntax error in module {} at {}:{}: {}", module.getName(), line, charPositionInLine, msg, e);
  exceptions.add(new LeafRefPathSyntaxErrorException(module.getName(), line, charPositionInLine, msg, e));
}

代码示例来源:origin: org.opendaylight.yangtools/yang-data-codec-gson

@Override
protected String prefixForNamespace(final URI namespace) {
  final Iterator<Module> modules = context.findModules(namespace).iterator();
  return modules.hasNext() ? modules.next().getName() : null;
}

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

@Override
  public boolean apply(final Module input) {
    final ModuleIdentifierImpl id = new ModuleIdentifierImpl(input.getName(), Optional.fromNullable(input.getNamespace()), Optional.fromNullable(input.getRevision()));
    return id.equals(moduleIdentifier);
  }
}).getSource();

代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl

@Override
protected String prefixForNamespace(final URI namespace) {
  final Module module = context.findModuleByNamespaceAndRevision(namespace, null);
  return module == null ? null : module.getName();
}

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

private org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160409.module.list.Module createModuleEntryFromModule(final Module module) {
  final ModuleBuilder moduleBuilder = new ModuleBuilder();
  // TODO Conformance type is always set to Implement value, but it should it really be like this?
  // TODO Add also deviations and features lists to module entries
  moduleBuilder.setName(new YangIdentifier(module.getName()))
      .setRevision(new OptionalRevision(SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision())))
      .setNamespace(new Uri(module.getNamespace().toString()))
      .setConformanceType(ConformanceType.Implement)
      .setSubmodules(createSubmodulesForModule(module));
  return moduleBuilder.build();
}

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

@Override
  protected String prefixForNamespace(final URI namespace) {
    final Iterator<Module> modules = context.findModules(namespace).iterator();
    return modules.hasNext() ? modules.next().getName() : null;
  }
}

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

@Override
protected String prefixForNamespace(final URI namespace) {
  final Iterator<Module> modules = context.findModules(namespace).iterator();
  return modules.hasNext() ? modules.next().getName() : null;
}

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

@Override
protected String prefixForNamespace(final URI namespace) {
  final Iterator<Module> modules = context.findModules(namespace).iterator();
  return modules.hasNext() ? modules.next().getName() : null;
}

代码示例来源:origin: org.opendaylight.yangtools/yang-data-codec-gson

private String toModuleNames(final Set<URI> potentialUris) {
  final StringBuilder builder = new StringBuilder();
  for (final URI potentialUri : potentialUris) {
    builder.append('\n');
    //FIXME how to get information about revision from JSON input? currently first available is used.
    builder.append(codecs.getSchemaContext().findModules(potentialUri).iterator().next().getName());
  }
  return builder.toString();
}

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

public static Module getSortedQName(final Set<Module> modules, final String name) {
  final TreeMap<Optional<Revision>, Module> sorted = new TreeMap<>(Revision::compare);
  for (Module module : modules) {
    if (name.equals(module.getName())) {
      sorted.put(module.getRevision(), module);
    }
  }
  return sorted.lastEntry().getValue();
}

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

/**
 * Returns module instances (from the context) with a concrete name. Returned Set is required to have its iteration
 * order guarantee that the latest revision is encountered first.
 *
 * @param name
 *            string with the module name
 * @return set of module instances with specified name.
 */
default Set<Module> findModules(final String name) {
  return Sets.filter(getModules(), m -> name.equals(m.getName()));
}

代码示例来源:origin: org.opendaylight.yangtools/yang-data-impl

@Override
public void enterPrefix(final PrefixContext ctx) {
  final String prefix = ctx.getText();
  if (!leafrefModule.getPrefix().equals(prefix)) {
    final Optional<QNameModule> qnameModuleOpt = getQNameModuleForImportPrefix(leafrefModule, prefix);
    checkArgument(qnameModuleOpt.isPresent(), "No module import for prefix: %s in module: %s", prefix,
      leafrefModule.getName());
    currentQnameModule = qnameModuleOpt.get();
  } else {
    currentQnameModule = leafrefModule.getQNameModule();
  }
}

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

@Override
void addCodegenInformation(final GeneratedTypeBuilder interfaceBuilder, final Module module,
    final String description, final Set<?  extends SchemaNode> nodes) {
  interfaceBuilder.addComment(TypeComments.javadoc("Interface for implementing the following YANG " + description
    + " defined in module <b>" + module.getName() + "</b>").get());
  YangSourceDefinition.of(module, nodes).ifPresent(interfaceBuilder::setYangSourceDefinition);
}

代码示例来源:origin: org.opendaylight.netconf/sal-rest-docgen

private String findModuleName(final YangInstanceIdentifier id, final SchemaContext context) {
  PathArgument rootQName = id.getPathArguments().iterator().next();
  for (Module mod : context.getModules()) {
    if (mod.getDataChildByName(rootQName.getNodeType()) != null) {
      return mod.getName();
    }
  }
  return null;
}

代码示例来源:origin: org.opendaylight.netconf/sal-rest-docgen

private void processContainersAndLists(final Module module, final JSONObject models, final SchemaContext schemaContext)
    throws IOException, JSONException {
  String moduleName = module.getName();
  for (DataSchemaNode childNode : module.getChildNodes()) {
    // For every container and list in the module
    if (childNode instanceof ContainerSchemaNode || childNode instanceof ListSchemaNode) {
      processDataNodeContainer((DataNodeContainer) childNode, moduleName, models, true, schemaContext);
      processDataNodeContainer((DataNodeContainer) childNode, moduleName, models, false, schemaContext);
    }
  }
}

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

private String findYangModuleName(final QName qname, final SchemaContext schemaContext)
    throws ConfigXMLReaderException {
  for (Module m : schemaContext.getModules()) {
    if (qname.getModule().equals(m.getQNameModule())) {
      return m.getName();
    }
  }
  throw new ConfigXMLReaderException(
      String.format("%s: Could not find yang module for QName %s", logName, qname));
}

代码示例来源:origin: org.opendaylight.controller/blueprint

private String findYangModuleName(QName qname, SchemaContext schemaContext) {
  for(Module m: schemaContext.getModules()) {
    if(qname.getModule().equals(m.getQNameModule())) {
      return m.getName();
    }
  }
  setFailureMessage(String.format("%s: Could not find yang module for QName %s", logName(), qname));
  return null;
}

代码示例来源:origin: org.opendaylight.netconf/sal-rest-docgen

private void addRootPostLink(final Module module, final DataNodeContainer node, final List<Parameter> pathParams,
    final String resourcePath, final List<Api> apis) {
  if (containsListOrContainer(module.getChildNodes())) {
    final Api apiForRootPostUri = new Api();
    apiForRootPostUri.setPath(resourcePath);
    apiForRootPostUri.setOperations(operationPost(module.getName() + MODULE_NAME_SUFFIX,
        module.getDescription(), module, pathParams, true));
    apis.add(apiForRootPostUri);
  }
}

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

void emitModule(final Module input) {
  super.writer.startModuleNode(input.getName());
  emitModuleHeader(input);
  emitLinkageNodes(input);
  emitMetaNodes(input);
  emitRevisionNodes(input);
  emitBodyNodes(input);
  super.writer.endNode();
}

相关文章