Add common interface for preference values

This commit is contained in:
Antonin Delpeuch 2018-11-03 19:51:19 +00:00
parent fc7da40055
commit 9cab735dfc

View File

@ -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();
}
}