I asked:
So I am implementing an abstract class with 2 sub classes as suggested in:
I Followed the documentation in jackson annotations: jackson-annotations and Annotation Type JsonTypeInfo
But I don't know how to: // Include Java class name ("com.myempl.ImplClass") as JSON property "class"
on the abstract class:
@JsonTypeInfo(use=Id.CLASS, include=As.PROPERTY, property="class")
I get errors:
- Id cannot be resolved to a variable
- As cannot be resolved to a variable
And in the subclasses:
@JsonTypeInfo(use=Id.NAME, include=As.WRAPPER_OBJECT)
@JsonSubTypes({com.smartenit.client.business.rest.CapabilityWhenReadingAllDevices.class,
com.smartenit.client.business.rest.CapabilityWhenRequestingAttribute.class})
I get errors:
- Id cannot be resolved to a variable
- As cannot be resolved to a variable
- The value for annotation attribute JsonSubTypes.value must be some @com.fasterxml.jackson.annotation.JsonSubTypes.Type annotation