本文整理了Java中org.eclipse.ditto.json.JsonPointer.addLeaf()
方法的一些代码示例,展示了JsonPointer.addLeaf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonPointer.addLeaf()
方法的具体详情如下:
包路径:org.eclipse.ditto.json.JsonPointer
类名称:JsonPointer
方法名:addLeaf
[英]Creates a new JSON pointer by adding a level to this JSON pointer. For example, if this pointer is "/foo/bar" and addLevel() is called with a JSON key "baz" then the new JSON pointer is "/foo/bar/baz".
[中]通过向此JSON指针添加级别来创建新的JSON指针。例如,如果此指针为“/foo/bar”,并使用JSON键“baz”调用addLevel(),则新的JSON指针为“/foo/bar/baz”。
代码示例来源:origin: org.eclipse.ditto/ditto-protocol-adapter
@Override
public JsonPointer addLeaf(final JsonKey key) {
return jsonPointer.addLeaf(key);
}
代码示例来源:origin: eclipse/ditto
@Override
public JsonPointer addLeaf(final JsonKey key) {
return jsonPointer.addLeaf(key);
}
代码示例来源:origin: eclipse/ditto
private JsonPointer getAbsolutePointer(final ResourceNode resourceNode) {
final JsonPointer result = resourceNode.getParent()
.filter(p -> PolicyTreeNode.Type.RESOURCE == p.getType())
.map(p -> (ResourceNode) p)
.map(this::getAbsolutePointer) // Recursion!
.orElseGet(JsonFactory::emptyPointer);
return result.addLeaf(JsonFactory.newKey(resourceNode.getName()));
}
代码示例来源:origin: eclipse/ditto
@Override
default JsonPointer getResourcePath() {
final Message<?> message = getMessage();
final String box = message.getDirection() == MessageDirection.TO ? INBOX_PREFIX : OUTBOX_PREFIX;
final JsonPointer pathSuffix = JsonPointer.empty()
.addLeaf(JsonKey.of(box))
.addLeaf(JsonKey.of(MESSAGES_PREFIX))
.addLeaf(JsonKey.of(message.getSubject()));
final JsonPointer path = message.getFeatureId().map(fId -> JsonPointer.empty()
.addLeaf(JsonKey.of(FEATURES_PREFIX))
.addLeaf(JsonKey.of(fId)))
.orElse(JsonPointer.empty());
return path.append(pathSuffix);
}
代码示例来源:origin: org.eclipse.ditto/ditto-signals-commands-messages
@Override
default JsonPointer getResourcePath() {
final Message<?> message = getMessage();
final String box = message.getDirection() == MessageDirection.TO ? INBOX_PREFIX : OUTBOX_PREFIX;
final JsonPointer pathSuffix = JsonPointer.empty()
.addLeaf(JsonKey.of(box))
.addLeaf(JsonKey.of(MESSAGES_PREFIX))
.addLeaf(JsonKey.of(message.getSubject()));
final JsonPointer path = message.getFeatureId().map(fId -> JsonPointer.empty()
.addLeaf(JsonKey.of(FEATURES_PREFIX))
.addLeaf(JsonKey.of(fId)))
.orElse(JsonPointer.empty());
return path.append(pathSuffix);
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-persistence
private static Collection<ResourcePermissions> createEntriesForAttribute(final JsonPointer attributePointer,
final JsonValue attributeValue, final Enforcer policyEnforcer) {
final Collection<ResourcePermissions> result = new HashSet<>(3);
if (attributeValue.isObject() && !attributeValue.isNull()) {
final JsonObject jsonObject = attributeValue.asObject();
// Recursion!
jsonObject.forEach(
subField -> result.addAll(createEntriesForAttribute(attributePointer.addLeaf(subField.getKey()),
subField.getValue(), policyEnforcer)));
} else {
result.add(AttributeResourcePermissions.getInstance(attributePointer, attributeValue, policyEnforcer));
}
return result;
}
代码示例来源:origin: eclipse/ditto
private static Collection<ResourcePermissions> createEntriesForFeatureProperty(final CharSequence featureId,
final JsonPointer propertyPointer, final JsonValue propertyValue, final Enforcer policyEnforcer) {
final Collection<ResourcePermissions> result = new HashSet<>(3);
if (propertyValue.isObject() && !propertyValue.isNull()) {
final JsonObject propertyValueJsonObject = propertyValue.asObject();
// Recursion!
propertyValueJsonObject.forEach(subField -> result.addAll(
createEntriesForFeatureProperty(featureId, propertyPointer.addLeaf(subField.getKey()),
subField.getValue(), policyEnforcer)));
} else {
result.add(FeaturePropertyResourcePermissions.getInstance(featureId, propertyPointer, propertyValue,
policyEnforcer));
}
return result;
}
代码示例来源:origin: eclipse/ditto
private static Collection<ResourcePermissions> createEntriesForAttribute(final JsonPointer attributePointer,
final JsonValue attributeValue, final Enforcer policyEnforcer) {
final Collection<ResourcePermissions> result = new HashSet<>(3);
if (attributeValue.isObject() && !attributeValue.isNull()) {
final JsonObject jsonObject = attributeValue.asObject();
// Recursion!
jsonObject.forEach(
subField -> result.addAll(createEntriesForAttribute(attributePointer.addLeaf(subField.getKey()),
subField.getValue(), policyEnforcer)));
} else {
result.add(AttributeResourcePermissions.getInstance(attributePointer, attributeValue, policyEnforcer));
}
return result;
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-persistence
private static Collection<ResourcePermissions> createEntriesForFeatureProperty(final CharSequence featureId,
final JsonPointer propertyPointer, final JsonValue propertyValue, final Enforcer policyEnforcer) {
final Collection<ResourcePermissions> result = new HashSet<>(3);
if (propertyValue.isObject() && !propertyValue.isNull()) {
final JsonObject propertyValueJsonObject = propertyValue.asObject();
// Recursion!
propertyValueJsonObject.forEach(subField -> result.addAll(
createEntriesForFeatureProperty(featureId, propertyPointer.addLeaf(subField.getKey()),
subField.getValue(), policyEnforcer)));
} else {
result.add(FeaturePropertyResourcePermissions.getInstance(featureId, propertyPointer, propertyValue,
policyEnforcer));
}
return result;
}
代码示例来源:origin: bsinno/iot-things-examples
/**
* Collect list of individual property changes
*/
private static void collectChanges(List target, String thingId, String featureId, JsonPointer path,
JsonValue value) {
if (value.isObject()) {
// on Object recursively collect all individual properties with concatenated property path
JsonObject obj = value.asObject();
obj.forEach(c -> {
collectChanges(target, thingId, featureId, path.addLeaf(c.getKey()), c.getValue());
});
} else {
target.add(new History(thingId, featureId, path, value, LocalDateTime.now()));
}
}
代码示例来源:origin: eclipse/ditto
policyTreeNode.getChildren()
.forEach((s, child) -> traverseSubtreeForPermissionAccess(permission,
resource.addLeaf(JsonKey.of(s)), type, child, grantedResources,
revokedResources, level + 1, false));
代码示例来源:origin: eclipse/ditto
private static List<PointerAndValue> collectFlatPointers(final JsonPointer createdPointer, final JsonField field,
final List<PointerAndValue> flattenedFields) {
final JsonValue fieldValue = field.getValue();
if (fieldValue.isObject()) {
final JsonObject jsonObject = fieldValue.asObject();
if (!jsonObject.isEmpty()) {
jsonObject.forEach(jsonField -> collectFlatPointers(createdPointer.addLeaf(jsonField.getKey()),
jsonField, flattenedFields));
} else {
flattenedFields.add(new PointerAndValue(createdPointer, fieldValue));
}
} else {
flattenedFields.add(new PointerAndValue(createdPointer, fieldValue));
}
return flattenedFields;
}
内容来源于网络,如有侵权,请联系作者删除!