Attribute and Implicit Collection - xstream ambiguity

Hi Team, Hope you are fine.
Can you please help me to resolve my below problem. I have an xml element with attribute named as “value” which can have one value E.g. (1) below , but there can be another case which i can have it as a child element named as “value” with multiple values E.g. (2) below.
E.g. 1
<variable id="123" value="Adam"/>

E.g. 2

<variable id="123">
 ... ...

Can you please tell me how would i map this in Xstream serializer in same java class?
if i configure as below it gives me duplicate error

public class Variable {

private String id;

 private String value;

private List<String> value = new ArrayList<String>();

Hi @satya

I’m not sure if this is at all possible. I’d assume XStream would need to be consistent about things, and you can’t have it both ways.

That said, I think you’ll be better off asking this question at some forum related to XStream or on StackOverflow with the respective tag. This is not Axon-specific, and I guess most people here do not deal with XStream beyond the most obvious serialization cases. So IMHO, the chances of getting a good answer here in this particular case are not high.

thanks @milendyankov appreciated.I will put this in stackoverflow.