org.onosproject.yangutils.datamodel.YangType.getDataTypeExtendedInfo()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(112)

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

YangType.getDataTypeExtendedInfo介绍

[英]Returns the data type meta data.
[中]返回元数据的数据类型。

代码示例

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

/**
 * Returns resolvable entity under union. When types under union have
 * identity-ref, derived and union, the function call is done recursively
 * to get resolvable entity and adds it to list.
 *
 * @param type   union YANG type
 * @param isLeaf leaf or leaf-list
 * @return resolvable entity list after setting info
 * @throws DataModelException data model error
 */
private static List<YangEntityToResolveInfoImpl> getUnionResolvableEntity(
    YangType type, boolean isLeaf) throws DataModelException {
  YangUnion union = (YangUnion) type.getDataTypeExtendedInfo();
  List<YangType<?>> typeList = union.getTypeList();
  List<YangEntityToResolveInfoImpl> unionList = new ArrayList<>();
  List<YangEntityToResolveInfoImpl> entity;
  for (YangType unionType : typeList) {
    entity = getUnresolvedTypeList(unionType.getDataType(),
                    unionType, union, null, isLeaf);
    if (nonEmpty(entity)) {
      unionList.addAll(entity);
    }
  }
  return unionList;
}

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

switch (dataType.getDataType()) {
  case DERIVED:
    return ((YangDerivedInfo) dataType.getDataTypeExtendedInfo())
        .getEffectiveBuiltInType().equals(EMPTY);
        .getDataTypeExtendedInfo())
        .getEffectiveDataType();
    if (type.getDataType() == YangDataTypes.DERIVED) {
      return ((YangDerivedInfo) type.getDataTypeExtendedInfo())
          .getEffectiveBuiltInType().equals(EMPTY);
    return ((YangLeafRef) dataType.getDataTypeExtendedInfo())
        .getEffectiveDataType().getDataType().equals(EMPTY);
    return ((YangUnion) dataType.getDataTypeExtendedInfo())
        .getTypeList().contains(EMPTY);
  default:

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

case UINT32:
case UINT64: {
  if (getDataTypeExtendedInfo() == null) {
    getDataObjectFromString(value, getDataType());
  } else {
    if (!((YangRangeRestriction) getDataTypeExtendedInfo()).isValidValueString(value)) {
      throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
                        getDataType());
      (YangDecimal64<YangRangeRestriction>) getDataTypeExtendedInfo();
  validateDecimal64(value, decimal64.getFractionDigit(),
           decimal64.getRangeRestrictedExtendedInfo());
  if (getDataTypeExtendedInfo() == null) {
    break;
  } else if (!(((YangStringRestriction) getDataTypeExtendedInfo()).isValidStringOnLengthRestriction(value)
      && ((YangStringRestriction) getDataTypeExtendedInfo())
      .isValidStringOnPatternRestriction(value))) {
    throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
  Iterator<YangEnum> iterator = ((YangEnumeration) getDataTypeExtendedInfo()).getEnumSet().iterator();
  boolean isValidated = false;
  while (iterator.hasNext()) {
  YangBits bits = (YangBits) getDataTypeExtendedInfo();
  if (bits.fromString(value) == null) {
    throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " +
  if (!isValidBinary(value, (YangRangeRestriction) getDataTypeExtendedInfo())) {

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

/**
   * Performs validation and updates the data model tree.
   * It is called when parser exits from grammar rule (decimal64).
   *
   * @param listener listener's object
   * @param ctx      context object of the grammar rule
   */
  public static void processDecimal64Exit(TreeWalkListener listener,
                      GeneratedYangParser.Decimal64SpecificationContext ctx) {

    // Check for stack to be non empty.
    checkStackIsNotEmpty(listener, MISSING_HOLDER, DECIMAL64_DATA, "", EXIT);

    Parsable tmpNode = listener.getParsedDataStack().peek();
    if (tmpNode instanceof YangType) {
      YangType<YangDecimal64<YangRangeRestriction>> typeNode =
          (YangType<YangDecimal64<YangRangeRestriction>>) tmpNode;
      YangDecimal64<YangRangeRestriction> decimal64Node = typeNode.getDataTypeExtendedInfo();
      try {
        decimal64Node.validateRange();
      } catch (DataModelException e) {
        throw new ParserException(e);
      }
    } else {
      throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, DECIMAL64_DATA, "", EXIT));
    }
  }
}

代码示例来源: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-datamodel

String dataTypeName = null;
if (dataType.getDataType() == YangDataTypes.ENUMERATION) {
  YangEnumeration enumNode = (YangEnumeration) dataType.getDataTypeExtendedInfo();
  dataTypeName = enumNode.getName();
} else if (dataType.getDataType() == YangDataTypes.UNION) {
  YangUnion unionNode = (YangUnion) dataType.getDataTypeExtendedInfo();
  dataTypeName = unionNode.getName();

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

/**
 * It is called when parser enters grammar rule (fraction-digits), it perform
 * validations and updates the data model tree.
 *
 * @param listener listener's object
 * @param ctx      context object of the grammar rule
 */
public static void processFractionDigitsEntry(TreeWalkListener listener,
                       GeneratedYangParser.FractionDigitStatementContext ctx) {
  // Check for stack to be non empty.
  checkStackIsNotEmpty(listener, MISSING_HOLDER, FRACTION_DIGITS_DATA,
             ctx.fraction().getText(), ENTRY);
  int value = getValidFractionDigits(ctx);
  Parsable tmpNode = listener.getParsedDataStack().peek();
  if (tmpNode instanceof YangType) {
    YangType<YangDecimal64<YangRangeRestriction>> typeNode =
        (YangType<YangDecimal64<YangRangeRestriction>>) tmpNode;
    YangDecimal64 decimal64Node = typeNode.getDataTypeExtendedInfo();
    decimal64Node.setFractionDigit(value);
    if (!decimal64Node.isValidFractionDigit()) {
      throw new ParserException(constructErrorMsg(ctx, INVALID_CONTENT));
    }
  } else {
    throw new ParserException(constructErrorMsg(ctx, INVALID_HOLDER));
  }
}

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

YangStringRestriction stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
  if (stringRestriction == null) {
    stringRestriction = new YangStringRestriction();
} else {
  YangPatternRestriction patternRestriction = ((YangDerivedInfo<?>) type
      .getDataTypeExtendedInfo()).getPatternRestriction();
  if (patternRestriction == null) {
    patternRestriction = new YangPatternRestriction();
    ((YangDerivedInfo<?>) type.getDataTypeExtendedInfo()).setPatternRestriction(patternRestriction);
    patternRestriction.addPattern(patternArgument);
  } else {
    ((YangDerivedInfo<?>) type.getDataTypeExtendedInfo()).setPatternRestriction(patternRestriction);
    patternRestriction.addPattern(patternArgument);

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

.getDataTypeExtendedInfo()).getEffectiveBuiltInType();
YangDerivedInfo refDerivedInfo = (YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo();
T extendedInfo = (T) refDerivedInfo.getResolvedExtendedInfo();

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

YangLeafRef referredLeafRefInfo = (YangLeafRef) (yangLeaf.getDataType().getDataTypeExtendedInfo());
YangLeafRef referredLeafRefInfo = (YangLeafRef) yangLeafList.getDataType().getDataTypeExtendedInfo();

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

((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
      .setRangeRestrictionString(ctx.range().getText());
  ((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
      .setLineNumber(ctx.getStart().getLine());
  ((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
      .setCharPosition(ctx.getStart().getCharPositionInLine());
  return;
try {
  if (type.getDataType() == DECIMAL64) {
    YangDecimal64 yangDecimal64 = (YangDecimal64) type.getDataTypeExtendedInfo();
    rangeRestriction =
        processRangeRestriction(yangDecimal64.getDefaultRangeRestriction(),
    ((YangDecimal64<YangRangeRestriction>) type.getDataTypeExtendedInfo())
        .setRangeRestrictedExtendedInfo(rangeRestriction);
  } else {

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

@Override
public Object resolve()
    throws DataModelException {
  /*
   * Check whether the data type is derived.
   */
  if (getDataType() != DERIVED) {
    throw new DataModelException("Linker Error: Resolve should only be called for derived data types. "
                       + " in " +
                       getLineNumber() + " at " +
                       getCharPosition()
                       + " in " + getFileName() + "\"");
  }
  // Check if the derived info is present.
  YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) getDataTypeExtendedInfo();
  if (derivedInfo == null) {
    throw new DataModelException("Linker Error: Derived information is missing. " + " in " +
                       getLineNumber() + " at " +
                       getCharPosition()
                       + " in " + getFileName() + "\"");
  }
  // Initiate the resolution
  try {
    setResolvableStatus(derivedInfo.resolve());
  } catch (DataModelException e) {
    throw new DataModelException(e.getMessage());
  }
  return null;
}

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

((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
    .setLengthRestrictionString(ctx.length().getText());
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
    .setLineNumber(ctx.getStart().getLine());
((YangDerivedInfo<YangRangeRestriction>) type.getDataTypeExtendedInfo())
    .setCharPosition(ctx.getStart().getCharPositionInLine());
return;
YangStringRestriction stringRestriction = (YangStringRestriction) type.getDataTypeExtendedInfo();
if (stringRestriction == null) {
  stringRestriction = new YangStringRestriction();

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

YangType<?> baseType = getReferredTypeDef().getTypeDefBaseType();
YangDataTypes type = baseType.getDataType();
T extended = (T) baseType.getDataTypeExtendedInfo();

相关文章