From 332132d720d30cc7e6d4cb4123d9d0685e080690 Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Mon, 22 Oct 2018 11:42:05 +0100 Subject: [PATCH] Jackson deserialization for ColumnReorderOperation --- .../operations/column/ColumnReorderOperation.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/main/src/com/google/refine/operations/column/ColumnReorderOperation.java b/main/src/com/google/refine/operations/column/ColumnReorderOperation.java index 2b1fe8d93..4202d2341 100644 --- a/main/src/com/google/refine/operations/column/ColumnReorderOperation.java +++ b/main/src/com/google/refine/operations/column/ColumnReorderOperation.java @@ -33,31 +33,30 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.google.refine.operations.column; -import java.util.ArrayList; import java.util.List; import org.json.JSONObject; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.refine.history.HistoryEntry; import com.google.refine.model.AbstractOperation; import com.google.refine.model.Project; import com.google.refine.model.changes.ColumnReorderChange; -import com.google.refine.util.JSONUtilities; +import com.google.refine.util.ParsingUtilities; public class ColumnReorderOperation extends AbstractOperation { static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception { - List columnNames = new ArrayList(); - - JSONUtilities.getStringList(obj, "columnNames", columnNames); - - return new ColumnReorderOperation(columnNames); + return ParsingUtilities.mapper.readValue(obj.toString(), ColumnReorderOperation.class); } final protected List _columnNames; - public ColumnReorderOperation(List columnNames) { + @JsonCreator + public ColumnReorderOperation( + @JsonProperty("columnNames") + List columnNames) { _columnNames = columnNames; }