@XStreamAlias("ipmp")
public class Ipmp<T> implements Serializable {
private static final long serialVersionUID = -2075754377918779208L;
private Head head;
@XStreamAlias("body")
private T body;
public Head getHead() {
return head;
}
public Ipmp setHead(Head head) {
this.head = head;
return this;
}
public T getBody() {
return body;
}
public Ipmp setBody(T body) {
this.body = body;
return this;
}
}
Do generating
XStream xStream = new XStream();
xStream.processAnnotations(Ipmp.class);
Ipmp ipmp = new Ipmp<BalanceInfoQuery>();
Head head = new Head();
head.setBusiCode("10002").setReference("req".concat(String.valueOf(System.currentTimeMillis())));
ipmp.setHead(head);
BalanceInfoQuery balanceInfoQuery = new BalanceInfoQuery();
balanceInfoQuery.setAccount("01").setAccountType("02").setBankCode("03").setCurrency("USD").setDate("20230410").setQueryMode("00").setSubmitWay("00");
ipmp.setBody(balanceInfoQuery);
System.out.println(xStream.toXML(ipmp));
The body node has a attribute named class. I guess generating the class attribute for deserializing. But we don't need deserializing usring Java. The class attribute will cause issue in the next using case.
How to remove it? Does there any configuation working on it? Thanks
Have a class with generic type property as below:
Do generating
The result as below :
The body node has a attribute named class. I guess generating the class attribute for deserializing. But we don't need deserializing usring Java. The class attribute will cause issue in the next using case.
How to remove it? Does there any configuation working on it? Thanks