gpt4 book ai didi

org.opendaylight.yangtools.yang.xpath.api.YangQNameExpr类的使用及代码示例

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

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

YangQNameExpr介绍

[英]An XPath QName expression. This is an exact QName, which cannot be converted to a string literal compatible with XPath string representation, because it does not define a prefix/namespace mapping. It represents a strong binding to a particular namespace at a particular revision.

Parsers and users of this package are encouraged to use this class in place of YangLiteralExpr where appropriate, as it retains type safety and more semantic context.
[中]XPath QName表达式。这是一个精确的QName,不能转换为与XPath字符串表示兼容的字符串文字,因为它没有定义前缀/命名空间映射。它表示在特定修订版上对特定名称空间的强绑定。
鼓励该包的解析器和用户在适当的情况下使用该类代替YangLiteralExpr,因为它保留了类型安全性和更多语义上下文。

代码示例

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

public static YangQNameExpr of(final QName qname) {
  return new YangQNameExpr(qname);
}

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

private Collection<YangExpr> parsePathArgumentPredicate(final instanceIdentifierParser.PredicateContext expr) {
  final ParseTree first = expr.getChild(0);
  if (first instanceof LeafListPredicateContext) {
    return ImmutableSet.of(YangBinaryOperator.EQUALS.exprWith(YangLocationPath.self(),
      parseEqStringValue(getChild(((LeafListPredicateContext) first)
        .getChild(LeafListPredicateExprContext.class, 0), EqQuotedStringContext.class, 1))));
  } else if (first instanceof PosContext) {
    return ImmutableSet.of(YangBinaryOperator.EQUALS.exprWith(Functions.POSITION,
      createNumber(((PosContext) first).getToken(instanceIdentifierParser.PositiveIntegerValue, 0)
        .getText())));
  }
  final int length = expr.getChildCount();
  final List<YangExpr> ret = new ArrayList<>(length);
  for (int i = 0; i < length; ++i) {
    final KeyPredicateExprContext pred = getChild(expr, KeyPredicateContext.class, i)
        .getChild(KeyPredicateExprContext.class, 0);
    ret.add(YangBinaryOperator.EQUALS.exprWith(
      YangQNameExpr.of(parseInstanceIdentifierQName(getChild(pred, NodeIdentifierContext.class, 0))),
      parseEqStringValue(getChild(pred, EqQuotedStringContext.class, 1))));
  }
  return ret;
}

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

private Collection<YangExpr> parsePathArgumentPredicate(final instanceIdentifierParser.PredicateContext expr) {
  final ParseTree first = expr.getChild(0);
  if (first instanceof LeafListPredicateContext) {
    return ImmutableSet.of(YangBinaryOperator.EQUALS.exprWith(YangLocationPath.self(),
      parseEqStringValue(getChild(((LeafListPredicateContext) first)
        .getChild(LeafListPredicateExprContext.class, 0), EqQuotedStringContext.class, 1))));
  } else if (first instanceof PosContext) {
    return ImmutableSet.of(YangBinaryOperator.EQUALS.exprWith(Functions.POSITION,
      createNumber(((PosContext) first).getToken(instanceIdentifierParser.PositiveIntegerValue, 0)
        .getText())));
  }
  final int length = expr.getChildCount();
  final List<YangExpr> ret = new ArrayList<>(length);
  for (int i = 0; i < length; ++i) {
    final KeyPredicateExprContext pred = getChild(expr, KeyPredicateContext.class, i)
        .getChild(KeyPredicateExprContext.class, 0);
    ret.add(YangBinaryOperator.EQUALS.exprWith(
      YangQNameExpr.of(parseInstanceIdentifierQName(getChild(pred, NodeIdentifierContext.class, 0))),
      parseEqStringValue(getChild(pred, EqQuotedStringContext.class, 1))));
  }
  return ret;
}

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

public static YangQNameExpr of(final QName qname) {
  return new YangQNameExpr(qname);
}

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