View Javadoc

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  	public void close() throws XMLStreamException {
38  		wrappedEventReader.close();
39  		
40  	}
41  
42  	public String getElementText() throws XMLStreamException {
43  		return wrappedEventReader.getElementText();
44  	}
45  
46  	public Object getProperty(String name) throws IllegalArgumentException {
47  		return wrappedEventReader.getProperty(name);
48  	}
49  
50  	public boolean hasNext() {
51  		return wrappedEventReader.hasNext();
52  	}
53  
54  	public XMLEvent nextEvent() throws XMLStreamException {
55  		return wrappedEventReader.nextEvent();
56  	}
57  
58  	public XMLEvent nextTag() throws XMLStreamException {
59  		return wrappedEventReader.nextTag();
60  	}
61  
62  	public XMLEvent peek() throws XMLStreamException {
63  		return wrappedEventReader.peek();
64  	}
65  
66  	public Object next() {
67  		return wrappedEventReader.next();
68  	}
69  
70  	public void remove() {
71  		wrappedEventReader.remove();
72  	}
73  
74  }