/** * Write a {@code <Singleton>} element for a given {@code Singleton}. * * @param singleton The given {@code Singleton}. It can not be {@code null}. * @throws javax.xml.stream.XMLStreamException if unable to write to stream */ public void write(Singleton singleton) throws XMLStreamException { LOG.debug("Writing singleton {} of type {}", singleton.getName(), singleton.getTypeName()); xmlWriter.writeStartElement(SINGLETON); xmlWriter.writeAttribute(NAME, singleton.getName()); xmlWriter.writeAttribute(TYPE, singleton.getTypeName()); for (NavigationPropertyBinding navPropertyBinding : singleton.getNavigationPropertyBindings()) { xmlWriter.writeStartElement(NAVIGATION_PROPERTY_BINDING); xmlWriter.writeAttribute(PATH, navPropertyBinding.getPath()); xmlWriter.writeAttribute(TARGET, navPropertyBinding.getTarget()); xmlWriter.writeEndElement(); } xmlWriter.writeEndElement(); } }
/** * Write a {@code <Singleton>} element for a given {@code Singleton}. * * @param singleton The given {@code Singleton}. It can not be {@code null}. * @throws javax.xml.stream.XMLStreamException if unable to write to stream */ public void write(Singleton singleton) throws XMLStreamException { LOG.debug("Writing singleton {} of type {}", singleton.getName(), singleton.getTypeName()); xmlWriter.writeStartElement(SINGLETON); xmlWriter.writeAttribute(NAME, singleton.getName()); xmlWriter.writeAttribute(TYPE, singleton.getTypeName()); for (NavigationPropertyBinding navPropertyBinding : singleton.getNavigationPropertyBindings()) { xmlWriter.writeStartElement(NAVIGATION_PROPERTY_BINDING); xmlWriter.writeAttribute(PATH, navPropertyBinding.getPath()); xmlWriter.writeAttribute(TARGET, navPropertyBinding.getTarget()); xmlWriter.writeEndElement(); } xmlWriter.writeEndElement(); } }