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 );
}
}