本文整理了Java中org.eclipse.ditto.json.JsonField.getValue()
方法的一些代码示例,展示了JsonField.getValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonField.getValue()
方法的具体详情如下:
包路径:org.eclipse.ditto.json.JsonField
类名称:JsonField
方法名:getValue
[英]Returns this JSON field's value.
[中]返回此JSON字段的值。
代码示例来源:origin: org.eclipse.ditto/ditto-json
private Optional<JsonValue> getValueForKey(final CharSequence key) {
final JsonField jsonField = fields.get(key.toString());
return null != jsonField ? Optional.of(jsonField.getValue()) : Optional.empty();
}
代码示例来源:origin: org.eclipse.ditto/ditto-json
/**
* Returns a {@code Predicate} for testing if the value of a JSON field is null.
*
* @return the predicate.
* @see JsonValue#isNull()
*/
static Predicate<JsonField> isValueNonNull() {
return jsonField -> !jsonField.getValue().isNull();
}
代码示例来源:origin: eclipse/ditto
/**
* Returns a {@code Predicate} for testing if the value of a JSON field is null.
*
* @return the predicate.
* @see JsonValue#isNull()
*/
static Predicate<JsonField> isValueNonNull() {
return jsonField -> !jsonField.getValue().isNull();
}
代码示例来源:origin: org.eclipse.ditto/ditto-model-connectivity
private static Map<String, String> getSpecificConfiguration(final JsonObject jsonObject) {
return jsonObject.getValue(JsonFields.SPECIFIC_CONFIG)
.filter(JsonValue::isObject)
.map(JsonValue::asObject)
.map(JsonObject::stream)
.map(jsonFields -> jsonFields.collect(Collectors.toMap(JsonField::getKeyName,
f -> f.getValue().isString() ? f.getValue().asString() : f.getValue().toString())))
.orElse(Collections.emptyMap());
}
代码示例来源:origin: eclipse/ditto
private static List<Document> createInternalAttributes(final Iterable<JsonField> attributes) {
final List<Document> internalFlatList = new ArrayList<>();
for (final JsonField attribute : attributes) {
final JsonValue value = attribute.getValue();
final JsonKey key = attribute.getKey();
internalFlatList.addAll(toFlatAttributesList(PersistenceConstants.SLASH + key, value, new ArrayList<>()));
}
return internalFlatList;
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-persistence
private static List<Document> createInternalAttributes(final Iterable<JsonField> attributes) {
final List<Document> internalFlatList = new ArrayList<>();
for (final JsonField attribute : attributes) {
final JsonValue value = attribute.getValue();
final JsonKey key = attribute.getKey();
internalFlatList.addAll(toFlatAttributesList(PersistenceConstants.SLASH + key, value, new ArrayList<>()));
}
return internalFlatList;
}
代码示例来源:origin: eclipse/ditto
@Nullable
private JsonValue getViewForJsonFieldOrNull(final JsonField jsonField,
final PolicyTrie defaultPolicyTrie,
final Set<String> subjectIds,
final Permissions permissions) {
final PolicyTrie relevantTrie = children.getOrDefault(jsonField.getKey(), defaultPolicyTrie);
return relevantTrie.getViewForJsonValueOrNull(jsonField.getValue(), subjectIds, permissions);
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-persistence
private static List<Document> createFlatFeaturesRepresentation(final Iterable<JsonField> properties,
final String featureId) {
final List<Document> flatFeatures = new ArrayList<>();
properties.forEach(field -> toFlatFeaturesList(PersistenceConstants.SLASH + field.getKeyName(), featureId,
field.getValue(), flatFeatures));
return flatFeatures;
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-persistence
private static void handleObject(final String path,
final Iterable<JsonField> jsonObject,
final String featureId,
final List<Document> flatAttributes) {
jsonObject.forEach(jsonField -> {
final String newPath = path + PersistenceConstants.SLASH + jsonField.getKey();
final JsonValue innerValue = jsonField.getValue();
toFlatFeaturesList(newPath, featureId, innerValue, flatAttributes);
});
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-persistence
private static Collection<ResourcePermissions> createEntriesForAttributes(final Attributes attributes,
final Enforcer policyEnforcer) {
final Collection<ResourcePermissions> result = new HashSet<>();
attributes.forEach(attribute -> result.addAll(
createEntriesForAttribute(JsonFactory.newPointer(attribute.getKey()), attribute.getValue(),
policyEnforcer)));
return result;
}
代码示例来源:origin: eclipse/ditto
private Set<JsonField> calculateThresholdViolations(final String featureId,
final FeatureProperties featureProperties) {
return featureProperties.stream()
.filter(field -> violatesThreshold(
field.getKey().asPointer(),
field.getValue(),
featurePropertyOverhead(featureId),
MAX_INDEX_CONTENT_LENGTH))
.collect(Collectors.toSet());
}
代码示例来源:origin: eclipse/ditto
private static Collection<ResourcePermissions> createEntriesForAttributes(final Attributes attributes,
final Enforcer policyEnforcer) {
final Collection<ResourcePermissions> result = new HashSet<>();
attributes.forEach(attribute -> result.addAll(
createEntriesForAttribute(JsonFactory.newPointer(attribute.getKey()), attribute.getValue(),
policyEnforcer)));
return result;
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-persistence
private Set<JsonField> calculateThresholdViolations(final Attributes attributes) {
return attributes
.stream()
.filter(field -> violatesThreshold(field.getKey().asPointer(),
field.getValue(),
attributeOverhead(),
MAX_INDEX_CONTENT_LENGTH))
.collect(Collectors.toSet());
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-persistence
private Set<JsonField> calculateThresholdViolations(final String featureId,
final FeatureProperties featureProperties) {
return featureProperties.stream()
.filter(field -> violatesThreshold(
field.getKey().asPointer(),
field.getValue(),
featurePropertyOverhead(featureId),
MAX_INDEX_CONTENT_LENGTH))
.collect(Collectors.toSet());
}
代码示例来源:origin: eclipse/ditto
private static void compareFieldValues(final JsonField expectedField, final JsonField actualField,
final boolean compareFieldDefinitions) {
compareValuesWithFieldKey(expectedField.getKey(), expectedField.getValue(),
actualField.getValue(), compareFieldDefinitions);
}
代码示例来源:origin: org.eclipse.ditto/ditto-json
@Override
protected String createStringRepresentation() {
final com.eclipsesource.json.JsonObject minJsonObject = new com.eclipsesource.json.JsonObject();
fields.values().forEach(field -> minJsonObject.add(field.getKeyName(), JsonFactory.convert(field.getValue())));
return minJsonObject.toString();
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-persistence
private static Collection<ResourcePermissions> createEntriesForFeature(final Feature feature,
final Enforcer policyEnforcer) {
final Collection<ResourcePermissions> result = new HashSet<>();
result.add(FeatureResourcePermissions.getInstance(feature, policyEnforcer));
final FeatureProperties featureProperties = feature.getProperties().orElseGet(
ThingsModelFactory::emptyFeatureProperties);
featureProperties.forEach(featureProperty -> result.addAll(
createEntriesForFeatureProperty(feature.getId(), JsonFactory.newPointer(featureProperty.getKey()),
featureProperty.getValue(), policyEnforcer)));
return result;
}
代码示例来源:origin: eclipse/ditto
protected static Map<String, String> toMap(final JsonValueContainer<JsonField> jsonObject) {
checkNotNull(jsonObject, "JSON object");
final Map<String, String> result = new HashMap<>(jsonObject.getSize());
jsonObject.forEach(jsonField -> {
final JsonValue jsonValue = jsonField.getValue();
final String stringValue = jsonValue.isString() ? jsonValue.asString() : jsonValue.toString();
result.put(jsonField.getKeyName(), stringValue);
});
return result;
}
代码示例来源:origin: org.eclipse.ditto/ditto-model-base
protected static Map<String, String> toMap(final JsonValueContainer<JsonField> jsonObject) {
checkNotNull(jsonObject, "JSON object");
final Map<String, String> result = new HashMap<>(jsonObject.getSize());
jsonObject.forEach(jsonField -> {
final JsonValue jsonValue = jsonField.getValue();
final String stringValue = jsonValue.isString() ? jsonValue.asString() : jsonValue.toString();
result.put(jsonField.getKeyName(), stringValue);
});
return result;
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-persistence
private Attributes fixViolations(final Set<JsonField> exceededAttributes,
final Attributes attributes) {
final AttributesBuilder builder = attributes.toBuilder();
exceededAttributes.forEach(field -> builder.set(
field.getKey().toString(),
fixViolation(field.getKey().asPointer(),
field.getValue(),
attributeOverhead(),
MAX_INDEX_CONTENT_LENGTH)));
return builder.build();
}
内容来源于网络,如有侵权,请联系作者删除!