| 1 | package org.springframework.batch.item.xml.stax; |
| 2 | |
| 3 | import javax.xml.namespace.NamespaceContext; |
| 4 | import javax.xml.stream.XMLEventReader; |
| 5 | import javax.xml.stream.XMLEventWriter; |
| 6 | import javax.xml.stream.XMLStreamException; |
| 7 | import javax.xml.stream.events.XMLEvent; |
| 8 | |
| 9 | /** |
| 10 | * Delegates all functionality to the wrapped writer allowing |
| 11 | * subclasses to override only the methods they want to change. |
| 12 | * |
| 13 | * @author Robert Kasanicky |
| 14 | */ |
| 15 | abstract class AbstractEventWriterWrapper implements XMLEventWriter { |
| 16 | |
| 17 | protected XMLEventWriter wrappedEventWriter; |
| 18 | |
| 19 | public AbstractEventWriterWrapper(XMLEventWriter wrappedEventWriter) { |
| 20 | this.wrappedEventWriter = wrappedEventWriter; |
| 21 | } |
| 22 | |
| 23 | public void add(XMLEvent event) throws XMLStreamException { |
| 24 | wrappedEventWriter.add(event); |
| 25 | } |
| 26 | |
| 27 | public void add(XMLEventReader reader) throws XMLStreamException { |
| 28 | wrappedEventWriter.add(reader); |
| 29 | } |
| 30 | |
| 31 | public void close() throws XMLStreamException { |
| 32 | wrappedEventWriter.close(); |
| 33 | } |
| 34 | |
| 35 | public void flush() throws XMLStreamException { |
| 36 | wrappedEventWriter.flush(); |
| 37 | } |
| 38 | |
| 39 | public NamespaceContext getNamespaceContext() { |
| 40 | return wrappedEventWriter.getNamespaceContext(); |
| 41 | } |
| 42 | |
| 43 | public String getPrefix(String uri) throws XMLStreamException { |
| 44 | return wrappedEventWriter.getPrefix(uri); |
| 45 | } |
| 46 | |
| 47 | public void setDefaultNamespace(String uri) throws XMLStreamException { |
| 48 | wrappedEventWriter.setDefaultNamespace(uri); |
| 49 | } |
| 50 | |
| 51 | public void setNamespaceContext(NamespaceContext context) throws XMLStreamException { |
| 52 | wrappedEventWriter.setNamespaceContext(context); |
| 53 | } |
| 54 | |
| 55 | public void setPrefix(String prefix, String uri) throws XMLStreamException { |
| 56 | wrappedEventWriter.setPrefix(prefix, uri); |
| 57 | } |
| 58 | } |