gpt4 book ai didi

org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.getPathArguments()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 17:28:40 28 4
gpt4 key购买 nike

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

YangInstanceIdentifier.getPathArguments介绍

[英]Returns an ordered iteration of path arguments.
[中]返回路径参数的有序迭代。

代码示例

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

/**
 * Check whether the data to be written consists only from mixins
 */
private static boolean containsOnlyNonVisibleData(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
  // There's only one such case:top level list (pathArguments == 1 && data is Mixin)
  // any other mixin nodes are contained by a "regular" node thus visible when serialized
  return path.getPathArguments().size() == 1 && data instanceof MixinNode;
}

代码示例来源:origin: org.opendaylight.bgpcep/bgp-rib-spi

private static NodeIdentifierWithPredicates firstKeyOf(final YangInstanceIdentifier id, final Predicate<PathArgument> match) {
  final PathArgument ret = Iterables.find(id.getPathArguments(), match);
  Preconditions.checkArgument(ret instanceof NodeIdentifierWithPredicates, "Non-key peer identifier %s", ret);
  return (NodeIdentifierWithPredicates) ret;
}

代码示例来源:origin: io.fd.honeycomb/data-impl

private static List<QName> extractSchemaPathQNames(final YangInstanceIdentifier topLevelIdentifier,
                            final Map.Entry<YangInstanceIdentifier.PathArgument, DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> entry) {
    // must be filtered out of augmentation and keyed NodeIdentifiers
    return Stream.concat(topLevelIdentifier.getPathArguments().stream(), Stream.of(entry.getKey()))
        .filter(pathArgument -> pathArgument instanceof YangInstanceIdentifier.NodeIdentifier)
        .map(YangInstanceIdentifier.PathArgument::getNodeType)
        .collect(Collectors.toList());
  }
}

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

public DataNormalizationOperation<?> getOperation(final YangInstanceIdentifier legacy)
    throws DataNormalizationException {
  DataNormalizationOperation<?> currentOp = operation;
  for (PathArgument pathArgument : legacy.getPathArguments()) {
    currentOp = currentOp.getChild(pathArgument);
  }
  return currentOp;
}

代码示例来源:origin: org.opendaylight.controller/sal-broker-impl

public static DataSchemaNode getSchemaNode(final SchemaContext schema,final YangInstanceIdentifier path) {
  checkArgument(schema != null,"YANG Schema must not be null.");
  checkArgument(path != null,"Path must not be null.");
  return getSchemaNode(schema, FluentIterable.from(path.getPathArguments()).transform(QNAME_FROM_PATH_ARGUMENT));
}

代码示例来源:origin: org.opendaylight.controller/sal-clustering-commons

private void writeYangInstanceIdentifierInternal(final YangInstanceIdentifier identifier) throws IOException {
  Collection<PathArgument> pathArguments = identifier.getPathArguments();
  output.writeInt(pathArguments.size());
  for(PathArgument pathArgument : pathArguments) {
    writePathArgument(pathArgument);
  }
}

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

private void writeYangInstanceIdentifierInternal(final YangInstanceIdentifier identifier) throws IOException {
  Collection<PathArgument> pathArguments = identifier.getPathArguments();
  output.writeInt(pathArguments.size());
  for (PathArgument pathArgument : pathArguments) {
    writePathArgument(pathArgument);
  }
}

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

@Override
  public Optional<NormalizedNode<?, ?>> apply(final DOMRpcResult result) {
    checkReadSuccess(result, path);
    final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataNode = findDataNode(result);
    return NormalizedNodes.findNode(dataNode, path.getPathArguments());
  }
});

代码示例来源:origin: org.opendaylight.mdsal/mdsal-dom-spi

void remove(final YangInstanceIdentifier id) {
    this.remove(id.getPathArguments().iterator());
  }
}

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

public static Optional<NormalizedNode<?, ?>> findNode(final NormalizedNode<?, ?> tree,
    final YangInstanceIdentifier path) {
  requireNonNull(tree, "Tree must not be null");
  requireNonNull(path, "Path must not be null");
  return findNode(Optional.of(tree), path.getPathArguments());
}

代码示例来源:origin: org.opendaylight.bgpcep/bgp-rib-spi

private static YangInstanceIdentifier firstIdentifierOf(final YangInstanceIdentifier id, final Predicate<PathArgument> match) {
  final int idx = Iterables.indexOf(id.getPathArguments(), match);
  Preconditions.checkArgument(idx != -1, "Failed to find %s in %s", match, id);
  // we want the element at index idx to be included in the list
  return YangInstanceIdentifier.create(Iterables.limit(id.getPathArguments(), idx + 1));
}

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

private void writeObject(final ObjectOutputStream outputStream) throws IOException {
  outputStream.defaultWriteObject();
  final FixedYangInstanceIdentifier p;
  if (parent instanceof FixedYangInstanceIdentifier) {
    p = (FixedYangInstanceIdentifier) parent;
  } else {
    p = FixedYangInstanceIdentifier.create(parent.getPathArguments(), parent.hashCode());
  }
  outputStream.writeObject(p);
}

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

public YangInstanceIdentifier toLegacy(final YangInstanceIdentifier normalized) throws DataNormalizationException {
  ImmutableList.Builder<PathArgument> legacyArgs = ImmutableList.builder();
  DataNormalizationOperation<?> currentOp = operation;
  for (PathArgument normalizedArg : normalized.getPathArguments()) {
    currentOp = currentOp.getChild(normalizedArg);
    if (!currentOp.isMixin()) {
      legacyArgs.add(normalizedArg);
    }
  }
  return YangInstanceIdentifier.create(legacyArgs.build());
}

代码示例来源:origin: org.opendaylight.controller/sal-distributed-datastore

private Collection<DataTreeCohortActor.CanCommit> perform(final RegistrationTreeNode<ActorRef> rootNode) {
    final List<PathArgument> toLookup = candidate.getRootPath().getPathArguments();
    lookupAndCreateCanCommits(toLookup, 0, rootNode);
    return messages;
  }
}

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

/**
 * Returns new builder for InstanceIdentifier with path arguments copied from original instance identifier.
 *
 * @param origin InstanceIdentifier from which path arguments are copied.
 * @return new builder for InstanceIdentifier with path arguments copied from original instance identifier.
 */
public static InstanceIdentifierBuilder builder(final YangInstanceIdentifier origin) {
  return new YangInstanceIdentifierBuilder(origin.getPathArguments(), origin.hashCode());
}

代码示例来源:origin: org.opendaylight.controller/sal-distributed-datastore

private String getModuleName(final YangInstanceIdentifier path) {
    if (path.isEmpty()) {
      return UNKNOWN_MODULE_NAME;
    }

    String namespace = path.getPathArguments().iterator().next().getNodeType().getNamespace().toASCIIString();
    String moduleName = configuration.getModuleNameFromNameSpace(namespace);
    return moduleName != null ? moduleName : UNKNOWN_MODULE_NAME;
  }
}

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

NormalizedNodeContext createContext(final YangInstanceIdentifier path) {
  NormalizedNodeContext result = root;
  for (PathArgument arg : path.getPathArguments()) {
    final Optional<NormalizedNode<?, ?>> node = NormalizedNodes.getDirectChild(result.getNode(), arg);
    checkArgument(node.isPresent(), "Node %s has no child %s", result.getNode(), arg);
    result = result.createChild(node.get());
  }
  return result;
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-dom-inmemory-datastore

@Override
  public DOMDataTreeWriteCursor createCursor(final DOMDataTreeIdentifier prefix) {
    Preconditions.checkState(!finished, "Transaction is finished/closed already.");
    Preconditions.checkState(cursor == null, "Previous cursor wasn't closed");
    final YangInstanceIdentifier relativePath = toRelative(prefix.getRootIdentifier());
    final DOMDataTreeWriteCursor ret = getCursor();
    ret.enter(relativePath.getPathArguments());
    return ret;
  }
}

代码示例来源: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: opendaylight/controller

private static DataSchemaContextNode<?> findSchemaNodeForNodePath(YangInstanceIdentifier nodePath,
    SchemaContext schemaContext) {
  DataSchemaContextNode<?> schemaNode = DataSchemaContextTree.from(schemaContext).getRoot();
  for (PathArgument arg : nodePath.getPathArguments()) {
    schemaNode = schemaNode.getChild(arg);
    if (schemaNode == null) {
      break;
    }
  }
  return schemaNode;
}

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