コード例 #1
0
 public static void main(String[] args) throws JAXBException {
   Iterator<Host> hosts = RhscConfiguration.getConfiguration().getHosts().iterator();
   Host host1 = hosts.next();
   Host host2 = hosts.next();
   host1.setId("1");
   host2.setId("2");
   Volume vol = new VolumeFactory().distributed("hi", host1, host2);
   String out = new MyMarshaller().marshall(JaxbContext.getContext(), vol);
   System.out.println(out);
 }
コード例 #2
0
 public Action unmarshalResult(ResponseWrapper result) {
   try {
     return (Action)
         JaxbContext.getContext()
             .createUnmarshaller()
             .unmarshal(new StringReader(result.getBody()));
   } catch (JAXBException e) {
     throw new RuntimeException("failed to unmarshal the request body");
   }
 }