public ElementParticle(ElementParticleConfig xml, Schema schema) { this.schema = schema; name = xml.getName(); type = Type.Factory.parse(xml.getType(), schema); attributes = new HashMap<String, String>(); for (MapEntryConfig entry : xml.getAttributeList()) { attributes.put(entry.getKey(), entry.getValue()); } }
public ElementParticleConfig save() { ElementParticleConfig xml = ElementParticleConfig.Factory.newInstance(); xml.setName(name); for (Map.Entry<String, String> entry : attributes.entrySet()) { MapEntryConfig mapEntry = xml.addNewAttribute(); mapEntry.setKey(entry.getKey()); mapEntry.setValue(entry.getValue()); } TypeConfig xml2 = type.save(); xml.setType(xml2); return xml; }