| 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.stream.XMLEventReader; |
| 20 | import javax.xml.stream.XMLStreamException; |
| 21 | import javax.xml.stream.events.XMLEvent; |
| 22 | |
| 23 | /** |
| 24 | * Delegates all functionality to the wrapped reader allowing |
| 25 | * subclasses to override only the methods they want to change. |
| 26 | * |
| 27 | * @author Robert Kasanicky |
| 28 | */ |
| 29 | abstract class AbstractEventReaderWrapper implements XMLEventReader { |
| 30 | |
| 31 | protected XMLEventReader wrappedEventReader; |
| 32 | |
| 33 | public AbstractEventReaderWrapper(XMLEventReader wrappedEventReader) { |
| 34 | this.wrappedEventReader = wrappedEventReader; |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | public void close() throws XMLStreamException { |
| 39 | wrappedEventReader.close(); |
| 40 | |
| 41 | } |
| 42 | |
| 43 | @Override |
| 44 | public String getElementText() throws XMLStreamException { |
| 45 | return wrappedEventReader.getElementText(); |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public Object getProperty(String name) throws IllegalArgumentException { |
| 50 | return wrappedEventReader.getProperty(name); |
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public boolean hasNext() { |
| 55 | return wrappedEventReader.hasNext(); |
| 56 | } |
| 57 | |
| 58 | @Override |
| 59 | public XMLEvent nextEvent() throws XMLStreamException { |
| 60 | return wrappedEventReader.nextEvent(); |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public XMLEvent nextTag() throws XMLStreamException { |
| 65 | return wrappedEventReader.nextTag(); |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public XMLEvent peek() throws XMLStreamException { |
| 70 | return wrappedEventReader.peek(); |
| 71 | } |
| 72 | |
| 73 | @Override |
| 74 | public Object next() { |
| 75 | return wrappedEventReader.next(); |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public void remove() { |
| 80 | wrappedEventReader.remove(); |
| 81 | } |
| 82 | |
| 83 | } |