@Test public void initialContextInfo_XML2JAVA() { try { String INITIAL_CONTEXT_XML = "<initialContextInfo>" + "<contextProperty value=\"value1\" name=\"name1\"/>" + "<contextProperty value=\"value2\" name=\"name2\"/>" + "</initialContextInfo>"; StringReader reader = new StringReader(INITIAL_CONTEXT_XML); JAXBContext jc = JAXBContext.newInstance(InitialContextInfo.class); Unmarshaller um = jc.createUnmarshaller(); InitialContextInfo icInfo = (InitialContextInfo) um.unmarshal(new StreamSource(reader), InitialContextInfo.class).getValue(); assertEquals("name1", icInfo.getContextProperty().get(0).getName()); assertEquals("name2", icInfo.getContextProperty().get(1).getName()); assertEquals("value2", icInfo.getContextProperty().get(1).getValue()); } catch (JAXBException jaxbe) { jaxbe.printStackTrace(); fail("No exception should be thrown"); } }
public List<Property> getContextProperty() { if (contextProperty==null) { contextProperty = new ArrayList<Property>(); } return contextProperty; }
InitialContextInfo implements Serializable { public List<Property> getContextProperty() { if (contextProperty==null) { contextProperty = new ArrayList<Property>(); } return contextProperty; } }
InitialContextInfo implements Serializable { public List<Property> getContextProperty() { if (contextProperty==null) { contextProperty = new ArrayList<Property>(); } return contextProperty; } InitialContextInfo(); }
InitialContextInfo implements Serializable { public List<Property> getContextProperty() { if (contextProperty==null) { contextProperty = new ArrayList<Property>(); } return contextProperty; } InitialContextInfo(); List<Property> getContextProperty(); void setProperty(List<Property> contextProperty); }
InitialContextInfo implements Serializable { public List<Property> getContextProperty() { if (contextProperty==null) { contextProperty = new ArrayList<Property>(); } return contextProperty; } InitialContextInfo(); List<Property> getContextProperty(); void setProperty(List<Property> contextProperty);  }