@Override public JsonValue getEntity(final JsonSchemaVersion schemaVersion) { return loggerConfigs.stream() .map(LoggerConfig::toJson) .collect(JsonCollectors.valuesToArray()); }
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()); }
.sorted(Comparator.comparingInt(Source::getIndex)) .map(source -> source.toJson(schemaVersion, thePredicate)) .collect(JsonCollectors.valuesToArray()), predicate.and(Objects::nonNull)); jsonObjectBuilder.set(JsonFields.TARGETS, targets.stream() .map(source -> source.toJson(schemaVersion, thePredicate)) .collect(JsonCollectors.valuesToArray()), predicate.and(Objects::nonNull)); jsonObjectBuilder.set(JsonFields.CLIENT_COUNT, clientCount, predicate); jsonObjectBuilder.set(JsonFields.FAILOVER_ENABLED, failOverEnabled, predicate); .stream() .map(entry -> JsonField.newInstance(entry.getKey(), JsonValue.of(entry.getValue()))) .collect(JsonCollectors.fieldsToObject()), predicate); .collect(JsonCollectors.valuesToArray()), predicate); return jsonObjectBuilder.build();
@Override public Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion) { final JsonObject jsonObject = StreamSupport.stream(policyEntries.spliterator(), false) .map(entry -> JsonFactory.newObjectBuilder() .set(entry.getLabel().getJsonFieldDefinition(), entry.toJson(schemaVersion, FieldType.regularOrSpecial())) .build()) .collect(JsonCollectors.objectsToObject()); return Optional.ofNullable(jsonObject); }
.sorted(Comparator.comparingInt(Source::getIndex)) .map(source -> source.toJson(schemaVersion, thePredicate)) .collect(JsonCollectors.valuesToArray()), predicate.and(Objects::nonNull)); jsonObjectBuilder.set(JsonFields.TARGETS, targets.stream() .map(source -> source.toJson(schemaVersion, thePredicate)) .collect(JsonCollectors.valuesToArray()), predicate.and(Objects::nonNull)); jsonObjectBuilder.set(JsonFields.CLIENT_COUNT, clientCount, predicate); jsonObjectBuilder.set(JsonFields.FAILOVER_ENABLED, failOverEnabled, predicate); .stream() .map(entry -> JsonField.newInstance(entry.getKey(), JsonValue.of(entry.getValue()))) .collect(JsonCollectors.fieldsToObject()), predicate); .collect(JsonCollectors.valuesToArray()), predicate); return jsonObjectBuilder.build();
@Override public Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion) { final JsonObject jsonObject = StreamSupport.stream(policyEntries.spliterator(), false) .map(entry -> JsonFactory.newObjectBuilder() .set(entry.getLabel().getJsonFieldDefinition(), entry.toJson(schemaVersion, FieldType.regularOrSpecial())) .build()) .collect(JsonCollectors.objectsToObject()); return Optional.ofNullable(jsonObject); }
@Override public JsonValue getEntity(final JsonSchemaVersion schemaVersion) { return loggerConfigs.stream() .map(LoggerConfig::toJson) .collect(JsonCollectors.valuesToArray()); }
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 Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion) { final JsonObject jsonObject = StreamSupport.stream(policyEntries.spliterator(), false) .map(entry -> JsonFactory.newObjectBuilder() .set(entry.getLabel().getJsonFieldDefinition(), entry.toJson(schemaVersion, FieldType.regularOrSpecial())) .build()) .collect(JsonCollectors.objectsToObject()); return Optional.ofNullable(jsonObject); }
private static JsonValue toJsonValueArray(final Collection<String> stringCollection) { return stringCollection.stream() .map(JsonFactory::newValue) .collect(JsonCollectors.valuesToArray()); }
@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 Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion) { final JsonObject jsonObject = StreamSupport.stream(policyEntries.spliterator(), false) .map(entry -> JsonFactory.newObjectBuilder() .set(entry.getLabel().getJsonFieldDefinition(), entry.toJson(schemaVersion, FieldType.regularOrSpecial())) .build()) .collect(JsonCollectors.objectsToObject()); return Optional.ofNullable(jsonObject); }
private static JsonArray toJsonArray(final Collection<?> c) { return c.stream() .map(JjwtSerializer::toJson) .collect(JsonCollectors.valuesToArray()); }
@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 protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(JSON_POLICY_ENTRIES, StreamSupport.stream(policyEntries.spliterator(), false) .map(entry -> JsonFactory.newObjectBuilder().set(entry.getLabel().getJsonFieldDefinition(), entry.toJson(schemaVersion, thePredicate), predicate).build()) .collect(JsonCollectors.objectsToObject()), predicate); }
private static JsonValue toJsonValueArray(final Collection<String> stringCollection) { return stringCollection.stream() .map(JsonFactory::newValue) .collect(JsonCollectors.valuesToArray()); }
@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 protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(JSON_POLICY_ENTRIES, StreamSupport.stream(policyEntries.spliterator(), false) .map(entry -> JsonFactory.newObjectBuilder().set(entry.getLabel().getJsonFieldDefinition(), entry.toJson(schemaVersion, thePredicate), predicate).build()) .collect(JsonCollectors.objectsToObject()), predicate); }
private static JsonArray toJsonArray(final Collection<?> c) { return c.stream() .map(JjwtSerializer::toJson) .collect(JsonCollectors.valuesToArray()); }
@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()); }