自动化立体仓库 - WMS系统
#
LSH
2023-11-17 b4ffbe0d45e17bd4a4f79c6201e92cc9d3091cb8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.zy.common.webservice.mock;
 
 
import com.alibaba.fastjson.JSON;
import com.zy.common.utils.XmlUtils;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
/**
 * Created by vincent on 2021/7/13
 */
public class XmlMock {
 
    public static void main(String[] args) {
        Demo demo = new Demo(1, "Steven", "@sun123", new Date(), 1000.0);
        List<Computer> list = new ArrayList<Computer>();
        list.add(new Computer("xxxMMeedd", "asus", new Date(), 4455.5));
        list.add(new Computer("lenvoXx", "lenvo", new Date(), 4999));
        demo.setComputers(list);
        System.out.println("---将对象转换成xml Start---");
        String xml = XmlUtils.objToXml(demo);
        System.out.println(xml);
        System.out.println("---将对象转换成File类型的xml End---");
        System.out.println();
        System.out.println("---将xml转换成对象 Start---");
        Demo demo1 = (Demo) XmlUtils.xmlToObj(Demo.class, xml);
        System.out.println(JSON.toJSONString(demo1));
        System.out.println("---将File类型的xml转换成对象 End---");
 
    }
 
 
}