gpt4 book ai didi

org.opendaylight.yangtools.yang.binding.YangModuleInfo.getNamespace()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 18:52:49 26 4
gpt4 key购买 nike

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

YangModuleInfo.getNamespace介绍

[英]Returns XML namespace associated to the YANG module
[中]返回与模块关联的XML命名空间

代码示例

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

/**
 * Given a {@link YangModuleInfo}, create a QName representing it. The QName
 * is formed by reusing the module's namespace and revision using the
 * module's name as the QName's local name.
 *
 * @param moduleInfo
 *            module information
 * @return QName representing the module
 */
public static QName getModuleQName(final YangModuleInfo moduleInfo) {
  checkArgument(moduleInfo != null, "moduleInfo must not be null.");
  return QName.create(moduleInfo.getNamespace(), moduleInfo.getRevision(), moduleInfo.getName());
}

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

public static final QNameModule getQNameModule(final YangModuleInfo modInfo) {
  return QNameModule.create(URI.create(modInfo.getNamespace()), QName.parseRevision(modInfo.getRevision()));
}

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

private static Optional<DataNodeContainer> findFirstDataNodeContainerInRpc(final SchemaContext ctx,
    final Class<? extends DataObject> targetType) {
  final YangModuleInfo moduleInfo;
  try {
    moduleInfo = BindingReflections.getModuleInfo(targetType);
  } catch (Exception e) {
    throw new IllegalArgumentException(
        String.format("Failed to load module information for class %s", targetType), e);
  }
  for(RpcDefinition rpc : ctx.getOperations()) {
    String rpcNamespace = rpc.getQName().getNamespace().toString();
    String rpcRevision = rpc.getQName().getFormattedRevision();
    if(moduleInfo.getNamespace().equals(rpcNamespace) && moduleInfo.getRevision().equals(rpcRevision)) {
      Optional<DataNodeContainer> potential = findInputOutput(rpc,targetType.getSimpleName());
      if(potential.isPresent()) {
        return potential;
      }
    }
  }
  return Optional.absent();
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com