gpt4 book ai didi

org.onosproject.yangutils.datamodel.YangLeafRef类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 13:17:31 30 4
gpt4 key购买 nike

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

YangLeafRef介绍

[英]Represents the leafref information.
[中]表示leafref信息。

代码示例

代码示例来源:origin: org.onosproject/onos-yang-datamodel

/**
 * Converts the prefixes in all the nodes of the leafref with respect to the uses node.
 *
 * @param leafrefForCloning leafref that is to be cloned
 * @param yangUses          instance of YANG uses where cloning is done
 * @throws DataModelException data model error
 */
private static void convertThePrefixesDuringChange(YangLeafRef leafrefForCloning, YangUses yangUses)
    throws DataModelException {
  List<YangAtomicPath> atomicPathList = leafrefForCloning.getAtomicPath();
  if (atomicPathList != null && !atomicPathList.isEmpty()) {
    Iterator<YangAtomicPath> atomicPathIterator = atomicPathList.listIterator();
    while (atomicPathIterator.hasNext()) {
      YangAtomicPath atomicPath = atomicPathIterator.next();
      Map<String, String> prefixesAndItsImportNameNode = leafrefForCloning.getPrefixAndNode();
      String prefixInPath = atomicPath.getNodeIdentifier().getPrefix();
      String importedNodeName = prefixesAndItsImportNameNode.get(prefixInPath);
      assignCurrentLeafedWithNewPrefixes(importedNodeName, atomicPath, yangUses);
    }
  }
}

代码示例来源:origin: org.onosproject/onos-yang-datamodel

@Override
public Object resolve()
    throws DataModelException {
  if (getReferredLeafOrLeafList() == null) {
    throw new DataModelException("Linker Error: The leafref does not refer to any leaf/leaf-list." +
        " in " +
        getLineNumber() + " at " +
        getCharPosition() +
        " in " + getFileName() + "\"");
  }
  // Initiate the resolution
  try {
    setResolvableStatus(getResolution());
  } catch (DataModelException e) {
    throw new DataModelException(e.getMessage());
  }
  return null;
}

代码示例来源:origin: org.onosproject/onos-yang-datamodel

if (getReferredLeafOrLeafList() instanceof YangLeaf) {
  YangLeaf yangLeaf = ((YangLeaf) getReferredLeafOrLeafList());
  YangType baseType = yangLeaf.getDataType();
    if (referredLeafRefInfo.getResolvableStatus() != INTRA_FILE_RESOLVED
        && referredLeafRefInfo.getResolvableStatus() != RESOLVED) {
      throw new DataModelException("Linker Error: Referred typedef is not resolved for type." +
          " in " +
          getLineNumber() + " at " +
          getCharPosition() +
          " in " + getFileName() + "\"");
    if ((referredLeafRefInfo.getResolvableStatus() == INTRA_FILE_RESOLVED)) {
      return INTRA_FILE_RESOLVED;
    List<YangIfFeature> referredLeafIfFeatureListFromLeafref = referredLeafRefInfo.getIfFeatureList();
    if (referredLeafIfFeatureListFromLeafref != null && !referredLeafIfFeatureListFromLeafref.isEmpty()) {
      Iterator<YangIfFeature> referredLeafIfFeature = referredLeafIfFeatureListFromLeafref.iterator();
      while (referredLeafIfFeature.hasNext()) {
        YangIfFeature ifFeature = referredLeafIfFeature.next();
        addIfFeatureList(ifFeature);
    setEffectiveDataType(referredLeafRefInfo.getEffectiveDataType());
  } else if (baseType.getDataType() == YangDataTypes.DERIVED) {
      throw new DataModelException("Linker Error: Referred typedef is not resolved for type." +
          " in " +
          getLineNumber() + " at " +
          getCharPosition() +

代码示例来源:origin: org.onosproject/onos-yang-utils-parser

YangLeafRef<?> leafRef = new YangLeafRef<>();
leafRef.setLineNumber(errorLine);
leafRef.setCharPosition(errorPosition);
leafRef.setFileName(listener.getFileName());
Parsable typeData = listener.getParsedDataStack().pop();
leafRef.setRequireInstance(true);
Parsable tmpData = listener.getParsedDataStack().peek();
    leafRef.setResolvableStatus(UNRESOLVED);
    leafRef.setParentNode((YangNode) parentNodeOfLeaf);
    if (listener.getGroupingDepth() == 0) {
      addToResolutionList(resolutionInfo);
    } else {
      leafRef.setInGrouping(true);
    leafRef.setResolvableStatus(UNRESOLVED);
    leafRef.setParentNode((YangNode) parentNodeOfLeafList);
      addToResolutionList(resolutionInfoImpl);
    } else {
      leafRef.setInGrouping(true);
    leafRef.setParentNode((YangNode) parentNodeOfLeafref);
    if (listener.getGroupingDepth() != 0) {
      leafRef.setInGrouping(true);

代码示例来源:origin: org.onosproject/onos-yang-datamodel

/**
 * Returns resolvable entity when the type is leaf-ref. It changes the
 * prefixes from grouping to uses, then changes the parent node to the
 * cloned node, sets needed information to entity such as line number,
 * position number and holder.
 *
 * @param type     YANG type of leaf-ref
 * @param yangUses YANG uses
 * @param holder   cloned holder
 * @return entity to resolve for leaf-ref
 * @throws DataModelException data model error
 */
private static YangEntityToResolveInfoImpl getLeafRefResolvableEntity(
    YangType type, YangUses yangUses, YangNode holder)
    throws DataModelException {
  YangEntityToResolveInfoImpl<YangLeafRef> leafRefInfo =
      new YangEntityToResolveInfoImpl<>();
  YangLeafRef leafRef = (YangLeafRef) type.getDataTypeExtendedInfo();
  // Conversion of prefixes in absolute path while cloning them.
  convertThePrefixesDuringChange(leafRef, yangUses);
  leafRef.setParentNode(holder);
  leafRefInfo.setEntityToResolve(leafRef);
  return setInformationInEntity(
      leafRefInfo, holder, leafRef.getCharPosition(),
      leafRef.getLineNumber());
}

代码示例来源:origin: org.onosproject/onos-yang-utils-parser

YangLeafRef<?> leafRef) {
Map<String, String> prefixMap = leafRef.getPrefixAndNode();
if (prefixMap == null) {
  prefixMap = new HashMap<>();
  leafRef.setPrefixAndNode(prefixMap);

代码示例来源:origin: org.onosproject/onos-yang-datamodel

YangType type = ((YangLeafRef) dataType
    .getDataTypeExtendedInfo())
    .getEffectiveDataType();
if (type.getDataType() == YangDataTypes.DERIVED) {
  return ((YangDerivedInfo) type.getDataTypeExtendedInfo())
    .getEffectiveDataType().getDataType().equals(EMPTY);

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