org.eclipse.ditto.json.JsonPointer.get()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(102)

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

JsonPointer.get介绍

[英]Returns the JSON key at the specified level within this JSON pointer.
[中]返回此JSON指针内指定级别的JSON键。

代码示例

代码示例来源:origin: org.eclipse.ditto/ditto-protocol-adapter

@Override
public Optional<JsonKey> get(final int level) {
  return jsonPointer.get(level);
}

代码示例来源:origin: org.eclipse.ditto/ditto-protocol-adapter

@Override
public Optional<MessageDirection> getDirection() {
  return jsonPointer.getRoot()
      .flatMap(ImmutableMessagePath::jsonKeyToDirection)
      .map(Optional::of)
      .orElseGet(() -> jsonPointer.getRoot()
          .filter(FEATURES::equals)
          .flatMap(features -> jsonPointer.get(2))
          .flatMap(ImmutableMessagePath::jsonKeyToDirection));
}

代码示例来源:origin: eclipse/ditto

private boolean isOnReferencePointer(final JsonPointer evaluationPointer) {
  boolean result = true;
  final int referencePointerLevelCount = referencePointer.getLevelCount();
  final int evaluationPointerLevelCount = evaluationPointer.getLevelCount();
  int currentLevel = 0;
  while (result &&
      currentLevel < referencePointerLevelCount &&
      currentLevel < evaluationPointerLevelCount) {
    final JsonKey referencePointerCurrentLevelKey = referencePointer.get(currentLevel).orElse(null);
    result = evaluationPointer.get(currentLevel)
        .filter(k -> k.equals(referencePointerCurrentLevelKey))
        .isPresent();
    currentLevel++;
  }
  return result;
}

代码示例来源:origin: eclipse/ditto

@Override
public Optional<MessageDirection> getDirection() {
  return jsonPointer.getRoot()
      .flatMap(ImmutableMessagePath::jsonKeyToDirection)
      .map(Optional::of)
      .orElseGet(() -> jsonPointer.getRoot()
          .filter(FEATURES::equals)
          .flatMap(features -> jsonPointer.get(2))
          .flatMap(ImmutableMessagePath::jsonKeyToDirection));
}

代码示例来源:origin: eclipse/ditto

@Override
public Optional<JsonKey> get(final int level) {
  return jsonPointer.get(level);
}

代码示例来源:origin: eclipse/ditto

protected static String featureIdFrom(final Adaptable adaptable) {
  final JsonPointer path = adaptable.getPayload().getPath();
  return path.get(1).orElseThrow(() -> UnknownPathException.newBuilder(path).build()).toString();
}

代码示例来源:origin: org.eclipse.ditto/ditto-protocol-adapter

protected static String featureIdFrom(final Adaptable adaptable) {
  final JsonPointer path = adaptable.getPayload().getPath();
  return path.get(1).orElseThrow(() -> UnknownPathException.newBuilder(path).build()).toString();
}

代码示例来源:origin: eclipse/ditto

grantedResources, revokedResources, level, true);
} else {
  resource.get(level).ifPresent(jsonKey -> policyTreeNode.getChild(jsonKey.toString())
      .ifPresent(child -> traverseSubtreeForPermissionAccess(permission, resource, type, child,
          grantedResources, revokedResources, level + 1, true)));
final Optional<JsonKey> jsonKeyOptional = resource.get(level);
if (followingResource && jsonKeyOptional.isPresent()) {
  policyTreeNode.getChild(jsonKeyOptional.get().toString())

相关文章