I have a type class:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="Record")
public class Record
{
@XmlAttribute(name="status")
private Status status ;
}
and enum class:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder={"status","error"})
@XmlEnum
public enum Status
{
OK(0, "No error"),
ERROR(1, "Some error") ;
@XmlAttribute(name="status", required=true)
private Integer status ;
@XmlAttribute(name="error", required=true)
private String error ;
private Status(Integer status, String error)
{
this.status=status ;
this.error=error ;
}
@Override
public String toString()
{
return "Status:" + this.status + " Error:" + this.error;
}
}
The result I am getting is: Record status="OK" but I want to have: Record status="OK" error="No error"
How can I achieve that ?