Jackson deserialization for DecoratedValue

This commit is contained in:
Antonin Delpeuch 2018-10-21 19:25:34 +01:00
parent 9c58b8f51f
commit 121dd76fa1

View File

@ -35,6 +35,7 @@ package com.google.refine.browsing;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.refine.util.StringUtils; import com.google.refine.util.StringUtils;
@ -52,7 +53,12 @@ public class DecoratedValue {
@JsonProperty("l") @JsonProperty("l")
final public String label; final public String label;
public DecoratedValue(Object value, String label) { @JsonCreator
public DecoratedValue(
@JsonProperty("v")
Object value,
@JsonProperty("l")
String label) {
if (value instanceof OffsetDateTime) { if (value instanceof OffsetDateTime) {
this.value = StringUtils.toString(value); this.value = StringUtils.toString(value);
} else { } else {