XStream

 annotation:

@XStreamAlias

The node of the generated xml can be modified. If the default node is used, it will not look good, and it is also inconvenient to convert. With this annotation, the usability is high.

// This annotation can also be implemented in Java code
xstream.alias("car", Car.class);

 

@XStreamAlias("car")
public class Car {
	
        @XStreamAlias("wheel")
	private String wheel;

	public String  getWheel() {
		return wheel;
	}
	public void setWheel(String wheel) {
		this.wheel = wheel;
	}

}

 Example after conversion to XML:

<car>
      <wheel>4个</wheel>
</car>

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326992743&siteId=291194637