zebiri djallil
zebiri djallil

Reputation: 334

Give a name to an XMLRootElement

This is my bean

package mypackage;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;


@XmlRootElement
@XmlType(propOrder={"columnName", "new_value"})
public class GetUserInfoResponse {

    private String columnName;
    private String new_value;

    @XmlElement(nillable = true, name = "nomChamps")
    public String getColumnName() {
        return columnName;
    }

    @XmlElement(nillable = true, name = "ValeurModifiee")
    public String getNew_value() {
        return new_value;
    }

}

And this is the result that i'm getting

{
  "getUserInfoResponse": [
    {
      "nomChamps": "AD_Client_ID",
      "ValeurModifiee": ""
    },
    {
      "nomChamps": "AD_Org1_ID",
      "ValeurModifiee": ""
    }
  ]
}

I'm getting like a title getUserInfoResponse (name of the class java bean)

Now, i want to get a specific title (example values in the place of class java name)

like this enter image description here

Upvotes: 3

Views: 6131

Answers (1)

AnthonyK
AnthonyK

Reputation: 473

Its simple

@XmlRootElement(name="values")

Upvotes: 7

Related Questions