Parameters extends ParameterComponent { public boolean set(String key, Object c) { boolean modificationDone = false; if (entry != null) { int nbEntry = entry.size(); for (int i = 0; i < nbEntry; i++) { ParameterComponent paramComp = entry.get(i); if (paramComp instanceof Parameter) { if (((Parameter) paramComp).getKey().equals(key)) { entry.remove(paramComp); i--; nbEntry--; } else { } } else if (paramComp instanceof Parameters) { ((Parameters) paramComp).set(key, c); modificationDone = true; } } } if (!modificationDone) { Parameter p = new Parameter(key, c); entry.add(p); } return modificationDone; } Parameters(); void setDescription(String description); void add(ParameterComponent p); boolean set(String key, Object c); Object get(String key); Object get(String desc, String key); Parameters getParameters(String desc); String getString(String name); String getString(String desc, String name); boolean getBoolean(String name); boolean getBoolean(String desc, String name); double getDouble(String name); int getInteger(String name); float getFloat(String name); @XmlElementRef(name = "parameter")
	public List<ParameterComponent> entry; @XmlAttribute(name = "description")
	public String description; }
@Test public void testMarshall() { Parameters p = new Parameters(); p.set("A", "B"); p.set("C", "D"); p.marshall("target/test-classes/test2.xml"); p.marshall(); try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; db = dbf.newDocumentBuilder(); File xml1 = new File(ParametersTest.class.getClassLoader().getResource("simple.xml").getPath()); Document doc1 = db.parse(xml1); assertEquals(doc1.getDocumentElement().getChildNodes().getLength(), 5); File xml2 = new File("target/test-classes/test2.xml"); Document doc2 = db.parse(xml2); assertEquals(doc2.getDocumentElement().getChildNodes().getLength(), 5); } catch (Exception e) { e.printStackTrace(); } }