use of uk.gov.justice.services.messaging.JsonEnvelope.METADATA in project microservice_framework by CJSCommonPlatform.
the class RestEnvelopeBuilder method payload.
private JsonObject payload() {
final JsonObjectBuilder payloadBuilder = initialPayload.map(jsonObject -> createObjectBuilderWithFilter(jsonObject, key -> !key.equals(METADATA))).orElse(Json.createObjectBuilder());
params.ifPresent(parameters -> parameters.forEach(param -> {
switch(param.getType()) {
case NUMERIC:
payloadBuilder.add(param.getName(), param.getNumericValue());
break;
case BOOLEAN:
payloadBuilder.add(param.getName(), param.getBooleanValue());
break;
default:
payloadBuilder.add(param.getName(), param.getStringValue());
}
}));
return payloadBuilder.build();
}
Aggregations