diff --git a/main/src/com/google/refine/preference/PreferenceValue.java b/main/src/com/google/refine/preference/PreferenceValue.java new file mode 100644 index 000000000..78d8e64f2 --- /dev/null +++ b/main/src/com/google/refine/preference/PreferenceValue.java @@ -0,0 +1,25 @@ +package com.google.refine.preference; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** + * Interface to be extended by all objects stored + * in the preferences. This ensures that their full class + * name is serialized with them. They should implement + * Jackson deserialization as usual. + * + * @author Antonin Delpeuch + */ + +@JsonTypeInfo( + use=JsonTypeInfo.Id.CLASS, + include=JsonTypeInfo.As.PROPERTY, + property="class") +public interface PreferenceValue { + + @JsonProperty("class") + public default String getClassName() { + return this.getClass().getName(); + } +}