I have the following java class
@XmlRootElement
@XmlSeeAlso(DataClass.class)
public static class EnvelopeClass<T> {
@XmlElement
public String version;
@XmlElement
public T data;
EnvelopeClass() {
}
EnvelopeClass(String version, T data) {
this.version = version;
this.data = data;
}
}
@XmlRootElement
public static class DataClass {
@XmlElement
public String name;
DataClass() {
}
DataClass(String name) {
this.name = name;
}
}
I'm creating its instance and marshaling it to json
EnvelopeClass<DataClass> dataClassEnvelopeClass = new EnvelopeClass<DataClass>("1.0", new DataClass("myName"));
I have next result:
{"version":"1.0","data":{"@type":"dataClass","name":"myName"}}
I do not want to have type type information in the json "@type":"dataClass", in other words I want to have next result:
{"version":"1.0","data":{"name":"myName"}}
Exactly this result I have when EnvelopeClass doesn't have Generics.
Is there a way to do this?