Tuesday, 9 February 2021

How to convert java autovalue class which implements JacksonModel to Kotlin?

Here is my piece of java code which represents interface and it's implementation. It's represent JackSonModel


/** Base class for all offline entities. */
public interface Entity extends JacksonModel, Serializable {

    String uri();

    String name();
}



@AutoValue
@JsonIgnoreProperties(ignoreUnknown = true)
public abstract class Playlist implements Entity {

    private static final long serialVersionUID = -659480502365267469L;

    @Override
    @JsonGetter("uri")
    public abstract String uri();

    @Override
    @JsonGetter("name")
    public abstract String name();


    @JsonCreator
    public static Playlist create(
            @NotNull @JsonProperty("uri") String uri, @NotNull @JsonProperty("name") String name) {
        return new AutoValue_Playlist(uri, name);
    }
}




from How to convert java autovalue class which implements JacksonModel to Kotlin?

No comments:

Post a Comment