Jackson deserialization for ColumnMoveOperation
This commit is contained in:
parent
99852a193c
commit
9af5b0a877
@ -33,8 +33,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.operations.column;
|
package com.google.refine.operations.column;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
@ -42,20 +45,21 @@ import com.google.refine.history.HistoryEntry;
|
|||||||
import com.google.refine.model.AbstractOperation;
|
import com.google.refine.model.AbstractOperation;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.model.changes.ColumnMoveChange;
|
import com.google.refine.model.changes.ColumnMoveChange;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class ColumnMoveOperation extends AbstractOperation {
|
public class ColumnMoveOperation extends AbstractOperation {
|
||||||
final protected String _columnName;
|
final protected String _columnName;
|
||||||
final protected int _index;
|
final protected int _index;
|
||||||
|
|
||||||
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
|
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws IOException {
|
||||||
return new ColumnMoveOperation(
|
return ParsingUtilities.mapper.readValue(obj.toString(), ColumnMoveOperation.class);
|
||||||
obj.getString("columnName"),
|
|
||||||
obj.getInt("index")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
public ColumnMoveOperation(
|
public ColumnMoveOperation(
|
||||||
|
@JsonProperty("columnName")
|
||||||
String columnName,
|
String columnName,
|
||||||
|
@JsonProperty("index")
|
||||||
int index
|
int index
|
||||||
) {
|
) {
|
||||||
_columnName = columnName;
|
_columnName = columnName;
|
||||||
|
Loading…
Reference in New Issue
Block a user