Source:
public static void toJSON(OutputWriter jsonWriter, PipelineConfig pipelineConfig) { jsonWriter.addLinks(linksWriter -> linksWriter .addLink("self", Routes.PipelineConfig.name(pipelineConfig.getName().toString())) .addAbsoluteLink("doc", Routes.PipelineConfig.DOC) .addLink("find", Routes.PipelineConfig.find())); pipelineConfig.errors().addAll(pipelineConfig.materialConfigs().errors()); if (!pipelineConfig.errors().isEmpty()) { jsonWriter.addChild("errors", errorWriter -> { HashMap<String, String> errorMapping = new HashMap<>(); errorMapping.put("labelTemplate", "label_template"); errorMapping.put("params", "parameters"); errorMapping.put("variables", "environment_variables"); errorMapping.put("trackingTool", "tracking_tool"); new ErrorGetter(errorMapping).toJSON(errorWriter, pipelineConfig); }); } jsonWriter.add("label_template", pipelineConfig.getLabelTemplate()); jsonWriter.add("lock_behavior", pipelineConfig.getLockBehavior()); jsonWriter.add("name", pipelineConfig.name()); jsonWriter.add("template", pipelineConfig.getTemplateName()); writeOrigin(jsonWriter, pipelineConfig.getOrigin()); jsonWriter.addChildList("parameters", getParams(pipelineConfig.getParams())); jsonWriter.addChildList("environment_variables", envVarsWriter -> EnvironmentVariableRepresenter.toJSON(envVarsWriter, pipelineConfig.getVariables())); jsonWriter.addChildList("materials", getMaterials(pipelineConfig.materialConfigs())); if (pipelineConfig.getStages().isEmpty()) { jsonWriter.renderNull("stages"); } else { jsonWriter.addChildList("stages", getStages(pipelineConfig)); } if (pipelineConfig.getTrackingTool() != null || pipelineConfig.getMingleConfig().isDefined()) { jsonWriter.addChild("tracking_tool", trackingToolWriter -> TrackingToolRepresenter.toJSON(trackingToolWriter, pipelineConfig)); } else { jsonWriter.renderNull("tracking_tool"); } if (pipelineConfig.getTimer() == null) { jsonWriter.renderNull("timer"); } else { jsonWriter.addChild("timer", timerWriter -> TimerRepresenter.toJSON(timerWriter, pipelineConfig.getTimer())); } }

Target:
public static void toJSON(OutputWriter jsonWriter, PipelineConfig pipelineConfig) { jsonWriter.addLinks(linksWriter -> linksWriter .addLink("self", Routes.PipelineConfig.name(pipelineConfig.getName().toString())) .addAbsoluteLink("doc", Routes.PipelineConfig.DOC) .addLink("find", Routes.PipelineConfig.find())); pipelineConfig.errors().addAll(pipelineConfig.materialConfigs().errors()); if (!pipelineConfig.errors().isEmpty()) { jsonWriter.addChild("errors", errorWriter -> { HashMap<String, String> errorMapping = new HashMap<>(); errorMapping.put("labelTemplate", "label_template"); errorMapping.put("params", "parameters"); errorMapping.put("variables", "environment_variables"); errorMapping.put("trackingTool", "tracking_tool"); new ErrorGetter(errorMapping).toJSON(errorWriter, pipelineConfig); }); } jsonWriter.add("label_template", pipelineConfig.getLabelTemplate()); jsonWriter.add("lock_behavior", pipelineConfig.getLockBehavior()); jsonWriter.add("name", pipelineConfig.name()); jsonWriter.add("template", pipelineConfig.getTemplateName()); writeOrigin(jsonWriter, pipelineConfig.getOrigin()); jsonWriter.addChildList("parameters", paramsWriter -> ParamRepresenter.toJSONArray(paramsWriter, pipelineConfig.getParams())); jsonWriter.addChildList("environment_variables", envVarsWriter -> EnvironmentVariableRepresenter.toJSON(envVarsWriter, pipelineConfig.getVariables())); jsonWriter.addChildList("materials", materialsWriter -> MaterialRepresenter.toJSONArray(materialsWriter, pipelineConfig.materialConfigs())); writeStages(jsonWriter, pipelineConfig); writeTrackingTool(jsonWriter, pipelineConfig); writeTimer(jsonWriter, pipelineConfig.getTimer()); }