private static JsonObject toJsonObject(final Map<?, ?> map) { return map.entrySet().stream() .map(entry -> JsonField.newInstance(String.valueOf(entry.getKey()), toJson(entry.getValue()))) .collect(JsonCollectors.fieldsToObject()); }
private static JsonObject toJsonObject(final Map<?, ?> map) { return map.entrySet().stream() .map(entry -> JsonField.newInstance(String.valueOf(entry.getKey()), toJson(entry.getValue()))) .collect(JsonCollectors.fieldsToObject()); }
@Override public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); return stream() // .filter(field -> !field.getDefinition().isPresent() || predicate.test(field)) // .collect(JsonCollectors.fieldsToObject()); }
@Override public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); return stream() // .filter(field -> !field.getDefinition().isPresent() || predicate.test(field)) // .collect(JsonCollectors.fieldsToObject()); }
@Override public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); return stream() // .filter(field -> !field.getDefinition().isPresent() || predicate.test(field)) // .collect(JsonCollectors.fieldsToObject()); }
@Override public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); return stream() // .filter(field -> !field.getDefinition().isPresent() || predicate.test(field)) // .collect(JsonCollectors.fieldsToObject()); }
static JsonObject mapBasicDBObjectToJsonObject(final BasicDBObject basicDBObject, final Function<String, String> jsonKeyNameReviser) { return basicDBObject.entrySet() .stream() .map(e -> JsonFactory.newField(reviseKeyName(e.getKey(), jsonKeyNameReviser), mapJavaObjectToJsonValue(e.getValue(), jsonKeyNameReviser))) .collect(JsonCollectors.fieldsToObject()); }
static JsonObject mapBsonDocumentToJsonObject(final BsonDocument bsonDocument, final Function<String, String> jsonKeyNameReviser) { return bsonDocument.entrySet() .stream() .map(e -> JsonFactory.newField(reviseKeyName(e.getKey(), jsonKeyNameReviser), mapBsonValueToJsonValue(e.getValue(), jsonKeyNameReviser))) .collect(JsonCollectors.fieldsToObject()); }
@Override public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); final JsonObjectBuilder jsonObjectBuilder = JsonFactory.newObjectBuilder(); jsonObjectBuilder.set(JsonFields.MAPPING_ENGINE, mappingEngine, predicate); jsonObjectBuilder.set(JsonFields.OPTIONS, options.entrySet().stream() .map(e -> JsonField.newInstance(e.getKey(), JsonValue.of(e.getValue()))) .collect(JsonCollectors.fieldsToObject()), predicate); return jsonObjectBuilder.build(); }
@Override public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); final JsonObjectBuilder jsonObjectBuilder = JsonFactory.newObjectBuilder(); jsonObjectBuilder.set(JsonFields.MAPPING_ENGINE, mappingEngine, predicate); jsonObjectBuilder.set(JsonFields.OPTIONS, options.entrySet().stream() .map(e -> JsonField.newInstance(e.getKey(), JsonValue.of(e.getValue()))) .collect(JsonCollectors.fieldsToObject()), predicate); return jsonObjectBuilder.build(); }
@Override public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); final JsonObjectBuilder jsonObjectBuilder = JsonFactory.newObjectBuilder(); jsonObjectBuilder.set(JsonFields.SCHEMA_VERSION, schemaVersion.toInt(), predicate); jsonObjectBuilder.set(JsonFields.ADDRESS_METRICS, addressMetrics.entrySet().stream() .map(e -> ImmutableAddressMetric.toJsonField(e.getKey(), e.getValue())) .collect(JsonCollectors.fieldsToObject()), predicate); jsonObjectBuilder.set(JsonFields.CONSUMED_MESSAGES, consumedMessages, predicate); return jsonObjectBuilder.build(); }
@Override public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); final JsonObjectBuilder jsonObjectBuilder = JsonFactory.newObjectBuilder(); jsonObjectBuilder.set(JsonFields.SCHEMA_VERSION, schemaVersion.toInt(), predicate); jsonObjectBuilder.set(JsonFields.ADDRESS_METRICS, addressMetrics.entrySet().stream() .map(e -> ImmutableAddressMetric.toJsonField(e.getKey(), e.getValue())) .collect(JsonCollectors.fieldsToObject()), predicate); jsonObjectBuilder.set(JsonFields.PUBLISHED_MESSAGES, publishedMessages, predicate); return jsonObjectBuilder.build(); }
@Override public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); final JsonObjectBuilder jsonObjectBuilder = JsonFactory.newObjectBuilder(); jsonObjectBuilder.set(JsonFields.SCHEMA_VERSION, schemaVersion.toInt(), predicate); jsonObjectBuilder.set(JsonFields.ADDRESS_METRICS, addressMetrics.entrySet().stream() .map(e -> ImmutableAddressMetric.toJsonField(e.getKey(), e.getValue())) .collect(JsonCollectors.fieldsToObject()), predicate); jsonObjectBuilder.set(JsonFields.CONSUMED_MESSAGES, consumedMessages, predicate); return jsonObjectBuilder.build(); }
@Override public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); final JsonObjectBuilder jsonObjectBuilder = JsonFactory.newObjectBuilder(); jsonObjectBuilder.set(JsonFields.SCHEMA_VERSION, schemaVersion.toInt(), predicate); jsonObjectBuilder.set(JsonFields.ADDRESS_METRICS, addressMetrics.entrySet().stream() .map(e -> ImmutableAddressMetric.toJsonField(e.getKey(), e.getValue())) .collect(JsonCollectors.fieldsToObject()), predicate); jsonObjectBuilder.set(JsonFields.PUBLISHED_MESSAGES, publishedMessages, predicate); return jsonObjectBuilder.build(); }
.map(entry -> JsonField.newInstance(entry.getKey(), JsonValue.of(entry.getValue()))) .collect(JsonCollectors.fieldsToObject());
.map(entry -> JsonField.newInstance(entry.getKey(), JsonValue.of(entry.getValue()))) .collect(JsonCollectors.fieldsToObject());
.stream() .map(entry -> JsonField.newInstance(entry.getKey(), JsonValue.of(entry.getValue()))) .collect(JsonCollectors.fieldsToObject()), predicate);
.stream() .map(entry -> JsonField.newInstance(entry.getKey(), JsonValue.of(entry.getValue()))) .collect(JsonCollectors.fieldsToObject()), predicate);