use of com.thoughtworks.go.config.FetchTask in project gocd by gocd.
the class FetchTaskRepresenter method fetchTaskFromJson.
private static AbstractFetchTask fetchTaskFromJson(JsonReader jsonReader) {
FetchTask fetchTask = new FetchTask();
if (jsonReader == null) {
return fetchTask;
}
setBaseTask(jsonReader, fetchTask);
Optional<Boolean> isSourceAFileValue = jsonReader.optBoolean("is_source_a_file");
Boolean isSourceAFile = isSourceAFileValue.orElse(false);
if (isSourceAFile) {
jsonReader.readStringIfPresent("source", fetchTask::setSrcfile);
} else {
jsonReader.readStringIfPresent("source", fetchTask::setSrcdir);
}
jsonReader.readStringIfPresent("destination", fetchTask::setDest);
return fetchTask;
}
Aggregations