Skip to content

Instantly share code, notes, and snippets.

View TrentBartlem's full-sized avatar

Trent Bartlem TrentBartlem

  • Australia
  • 22:32 (UTC +10:00)
View GitHub Profile
@christophercurrie
christophercurrie / Polymorph.java
Created February 11, 2014 17:20
Example of Polymorphic Deserialization using Jackson
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value=AudioAttachment.class, name="audio"),
@JsonSubTypes.Type(value=LinkAttachment.class, name="link")