当前位置: 首页 > 工具软件 > jfinal-rest > 使用案例 >

rest JAXBContext marshaller

管景天
2023-12-01
import com.ehongyue.services.userprofile.exception.RepoException;
import com.ehongyue.services.userprofile.jaxb.UserVO;
import com.ehongyue.services.userprofile.jaxb.UserVOs;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;


public class Main {
    public static void main(String[] args) throws RepoException, JAXBException{
        System.out.println("getUser");
        String key = "userid";
        String value = "1545872";
        String paramSequence = "loginname,tournament_points";
        Userprofile instance = new Userprofile();
        UserVO result = instance.getUser(key, value, paramSequence);
        
        List<UserVO> list= new ArrayList<UserVO>();
        list.add(result);


        value = "1544852";
        UserVO result1 = instance.getUser(key, value, paramSequence);
        list.add(result1);
        System.out.println("list size="+list.size());

        UserVOs userVOs = new UserVOs(list);

        JAXBContext jaxbCtx = JAXBContext.newInstance( UserVOs.class );
        Marshaller m = jaxbCtx.createMarshaller();
        m.setProperty("jaxb.formatted.output", true);
        m.marshal(userVOs, System.out );
    }
}


 类似资料:

相关阅读

相关文章

相关问答