forked from rcseacord/JavaSCR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimal.java
More file actions
20 lines (18 loc) · 688 Bytes
/
Copy pathAnimal.java
File metadata and controls
20 lines (18 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package jackpoly;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = As.PROPERTY, property = "@class")
@JsonSubTypes({@Type(value = Lion.class, name = "lion"), @Type(value = Elephant.class, name = "elephant")})
abstract class Animal {
@JsonProperty("name")
String name;
@JsonProperty("sound")
String sound;
@JsonProperty("type")
String type;
@JsonProperty("endangered")
boolean endangered;
}