@Test void complex() throws NoSuchMethodException { final List<ParameterMeta> params = service .buildParameterMetas(Model.class.getConstructor(Complex.class), "def", new BaseParameterEnricher.Context(new LocalConfigurationService(emptyList(), "test"))); final Map<String, String> payload = new TreeMap<>(); payload.put("configuration.objects[0].simple", "s"); payload.put("configuration.objects[0].otherObjects[0].value", "o11"); payload.put("configuration.objects[0].otherObjects[1].value", "o12"); payload.put("configuration.objects[1].otherObjects[0].value", "o21"); payload.put("configuration.objects[2].strings[0]", "s1"); payload.put("configuration.objects[2].strings[1]", "s2"); payload.put("configuration.simple", "rs"); payload.put("configuration.strings[0]", "rs1"); payload.put("configuration.other.value", "done"); final JsonValue value = extractorFactory.visitAndMap(params, payload); assertEquals("{\"configuration\":{\"objects\":[{\"otherObjects\":[{\"value\":\"o11\"},{\"value\":\"o12\"}]," + "\"simple\":\"s\"},{\"otherObjects\":[{\"value\":\"o21\"}]},{\"strings\":[\"s1\",\"s2\"]}]," + "\"other\":{\"value\":\"done\"},\"simple\":\"rs\",\"strings\":[\"rs1\"]}}", value.toString()); }
public JsonObject visitAndMap(final Collection<ParameterMeta> parameters, final Map<String, String> payload) { return unflatten("", ofNullable(parameters).orElseGet(Collections::emptyList), payload == null ? emptyMap() : payload); }
PayloadMapper { public JsonObject visitAndMap(final Collection<ParameterMeta> parameters, final Map<String, String> payload) { return unflatten("", ofNullable(parameters).orElseGet(Collections::emptyList), payload == null ? emptyMap() : payload); } }
PayloadMapper { public JsonObject visitAndMap(final Collection<ParameterMeta> parameters, final Map<String, String> payload) { return unflatten("", ofNullable(parameters).orElseGet(Collections::emptyList), payload == null ? emptyMap() : payload); }  }
PayloadMapper { public JsonObject visitAndMap(final Collection<ParameterMeta> parameters, final Map<String, String> payload) { return unflatten("", ofNullable(parameters).orElseGet(Collections::emptyList), payload == null ? emptyMap() : payload); }  JsonObject visitAndMap(final Collection<ParameterMeta> parameters, final Map<String, String> payload); }
PayloadMapper { public JsonObject visitAndMap(final Collection<ParameterMeta> parameters, final Map<String, String> payload) { return unflatten("", ofNullable(parameters).orElseGet(Collections::emptyList), payload == null ? emptyMap() : payload); }  JsonObject visitAndMap(final Collection<ParameterMeta> parameters, final Map<String, String> payload);  }