Skip to content

Instantly share code, notes, and snippets.

@jhiemer
Last active August 29, 2015 14:01
Show Gist options
  • Save jhiemer/f95ca403dc849692f482 to your computer and use it in GitHub Desktop.
Save jhiemer/f95ca403dc849692f482 to your computer and use it in GitHub Desktop.
@Document
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY,
property = "@class")
public class ChildOne extends Parent {
private long up;
private long down;
}
@Document
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY,
property = "@class")
public class ChildTwo extends ChildOne {
private long timespan;
}
@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
@JsonSubTypes({
@JsonSubTypes.Type(value = ChildOne.class),
@JsonSubTypes.Type(value = ChildTwo .class)
})
public class Parent extends AbstractDocument {
private String blu;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment