Jackson deserialization for ReconOperation

This commit is contained in:
Antonin Delpeuch 2018-10-22 10:38:55 +01:00
parent 08c2b8fb2b
commit 0a5ea4e3dd

View File

@ -44,6 +44,7 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
@ -75,19 +76,17 @@ public class ReconOperation extends EngineDependentOperation {
final protected String _columnName;
final protected ReconConfig _reconConfig;
static public ReconOperation reconstruct(Project project, JSONObject obj) throws Exception {
JSONObject engineConfig = obj.getJSONObject("engineConfig");
return new ReconOperation(
EngineConfig.reconstruct(engineConfig),
obj.getString("columnName"),
ReconConfig.reconstruct(obj.getJSONObject("config").toString())
);
static public ReconOperation reconstruct(Project project, JSONObject obj) throws IOException {
return ParsingUtilities.mapper.readValue(obj.toString(), ReconOperation.class);
}
@JsonCreator
public ReconOperation(
@JsonProperty("engineConfig")
EngineConfig engineConfig,
@JsonProperty("columnName")
String columnName,
@JsonProperty("config")
ReconConfig reconConfig
) {
super(engineConfig);