1 | /* |
2 | * Copyright 2006-2007 the original author or authors. |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | */ |
16 | |
17 | package org.springframework.batch.item.xml.stax; |
18 | |
19 | import javax.xml.namespace.NamespaceContext; |
20 | import javax.xml.stream.XMLEventReader; |
21 | import javax.xml.stream.XMLEventWriter; |
22 | import javax.xml.stream.XMLStreamException; |
23 | import javax.xml.stream.events.XMLEvent; |
24 | |
25 | /** |
26 | * Delegates all functionality to the wrapped writer allowing |
27 | * subclasses to override only the methods they want to change. |
28 | * |
29 | * @author Robert Kasanicky |
30 | */ |
31 | abstract class AbstractEventWriterWrapper implements XMLEventWriter { |
32 | |
33 | protected XMLEventWriter wrappedEventWriter; |
34 | |
35 | public AbstractEventWriterWrapper(XMLEventWriter wrappedEventWriter) { |
36 | this.wrappedEventWriter = wrappedEventWriter; |
37 | } |
38 | |
39 | public void add(XMLEvent event) throws XMLStreamException { |
40 | wrappedEventWriter.add(event); |
41 | } |
42 | |
43 | public void add(XMLEventReader reader) throws XMLStreamException { |
44 | wrappedEventWriter.add(reader); |
45 | } |
46 | |
47 | public void close() throws XMLStreamException { |
48 | wrappedEventWriter.close(); |
49 | } |
50 | |
51 | public void flush() throws XMLStreamException { |
52 | wrappedEventWriter.flush(); |
53 | } |
54 | |
55 | public NamespaceContext getNamespaceContext() { |
56 | return wrappedEventWriter.getNamespaceContext(); |
57 | } |
58 | |
59 | public String getPrefix(String uri) throws XMLStreamException { |
60 | return wrappedEventWriter.getPrefix(uri); |
61 | } |
62 | |
63 | public void setDefaultNamespace(String uri) throws XMLStreamException { |
64 | wrappedEventWriter.setDefaultNamespace(uri); |
65 | } |
66 | |
67 | public void setNamespaceContext(NamespaceContext context) throws XMLStreamException { |
68 | wrappedEventWriter.setNamespaceContext(context); |
69 | } |
70 | |
71 | public void setPrefix(String prefix, String uri) throws XMLStreamException { |
72 | wrappedEventWriter.setPrefix(prefix, uri); |
73 | } |
74 | } |