Jackson deserialization for MultiValuedCellJoinOperation

This commit is contained in:
Antonin Delpeuch 2018-10-22 12:15:12 +01:00
parent 379a12d349
commit 0cf8c2dd04
3 changed files with 11 additions and 17 deletions

View File

@ -51,16 +51,12 @@ import com.google.refine.model.Project;
import com.google.refine.model.Row;
import com.google.refine.model.changes.CellChange;
import com.google.refine.operations.EngineDependentMassCellOperation;
import com.google.refine.util.ParsingUtilities;
public class BlankDownOperation extends EngineDependentMassCellOperation {
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
JSONObject engineConfig = obj.getJSONObject("engineConfig");
return new BlankDownOperation(
EngineConfig.reconstruct(engineConfig),
obj.getString("columnName")
);
return ParsingUtilities.mapper.readValue(obj.toString(), BlankDownOperation.class);
}
@JsonCreator

View File

@ -52,16 +52,12 @@ import com.google.refine.model.Project;
import com.google.refine.model.Row;
import com.google.refine.model.changes.CellChange;
import com.google.refine.operations.EngineDependentMassCellOperation;
import com.google.refine.util.ParsingUtilities;
public class FillDownOperation extends EngineDependentMassCellOperation {
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
JSONObject engineConfig = obj.getJSONObject("engineConfig");
return new FillDownOperation(
EngineConfig.reconstruct(engineConfig),
obj.getString("columnName")
);
return ParsingUtilities.mapper.readValue(obj.toString(), FillDownOperation.class);
}
@JsonCreator

View File

@ -38,6 +38,7 @@ import java.util.List;
import org.json.JSONObject;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.refine.expr.ExpressionUtils;
@ -48,6 +49,7 @@ import com.google.refine.model.Column;
import com.google.refine.model.Project;
import com.google.refine.model.Row;
import com.google.refine.model.changes.MassRowChange;
import com.google.refine.util.ParsingUtilities;
public class MultiValuedCellJoinOperation extends AbstractOperation {
final protected String _columnName;
@ -55,16 +57,16 @@ public class MultiValuedCellJoinOperation extends AbstractOperation {
final protected String _separator;
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
return new MultiValuedCellJoinOperation(
obj.getString("columnName"),
obj.getString("keyColumnName"),
obj.getString("separator")
);
return ParsingUtilities.mapper.readValue(obj.toString(), MultiValuedCellJoinOperation.class);
}
@JsonCreator
public MultiValuedCellJoinOperation(
@JsonProperty("columnName")
String columnName,
@JsonProperty("keyColumnName")
String keyColumnName,
@JsonProperty("separator")
String separator
) {
_columnName = columnName;