001    /*
002     * Copyright 2010-2015 JetBrains s.r.o.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.jetbrains.kotlin.cli.common.modules;
018    
019    import org.jetbrains.annotations.NotNull;
020    import org.xml.sax.*;
021    import org.xml.sax.helpers.DefaultHandler;
022    
023    import java.io.IOException;
024    
025    public abstract class DelegatedSaxHandler extends DefaultHandler {
026    
027        @NotNull
028        protected abstract DefaultHandler getDelegate();
029    
030        @Override
031        public InputSource resolveEntity(String publicId, @NotNull String systemId) throws IOException, SAXException {
032            return getDelegate().resolveEntity(publicId, systemId);
033        }
034    
035        @Override
036        public void notationDecl(@NotNull String name, String publicId, String systemId) throws SAXException {
037            getDelegate().notationDecl(name, publicId, systemId);
038        }
039    
040        @Override
041        public void unparsedEntityDecl(@NotNull String name, String publicId, @NotNull String systemId, String notationName)
042                throws SAXException {
043            getDelegate().unparsedEntityDecl(name, publicId, systemId, notationName);
044        }
045    
046        @Override
047        public void setDocumentLocator(@NotNull Locator locator) {
048            getDelegate().setDocumentLocator(locator);
049        }
050    
051        @Override
052        public void startDocument() throws SAXException {
053            getDelegate().startDocument();
054        }
055    
056        @Override
057        public void endDocument() throws SAXException {
058            getDelegate().endDocument();
059        }
060    
061        @Override
062        public void startPrefixMapping(String prefix, @NotNull String uri) throws SAXException {
063            getDelegate().startPrefixMapping(prefix, uri);
064        }
065    
066        @Override
067        public void endPrefixMapping(String prefix) throws SAXException {
068            getDelegate().endPrefixMapping(prefix);
069        }
070    
071        @Override
072        public void startElement(@NotNull String uri, @NotNull String localName, @NotNull String qName, @NotNull Attributes attributes)
073                throws SAXException {
074            getDelegate().startElement(uri, localName, qName, attributes);
075        }
076    
077        @Override
078        public void endElement(String uri, @NotNull String localName, @NotNull String qName) throws SAXException {
079            getDelegate().endElement(uri, localName, qName);
080        }
081    
082        @Override
083        public void characters(char[] ch, int start, int length) throws SAXException {
084            getDelegate().characters(ch, start, length);
085        }
086    
087        @Override
088        public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
089            getDelegate().ignorableWhitespace(ch, start, length);
090        }
091    
092        @Override
093        public void processingInstruction(@NotNull String target, @NotNull String data) throws SAXException {
094            getDelegate().processingInstruction(target, data);
095        }
096    
097        @Override
098        public void skippedEntity(@NotNull String name) throws SAXException {
099            getDelegate().skippedEntity(name);
100        }
101    
102        @Override
103        public void warning(@NotNull SAXParseException e) throws SAXException {
104            getDelegate().warning(e);
105        }
106    
107        @Override
108        public void error(@NotNull SAXParseException e) throws SAXException {
109            getDelegate().error(e);
110        }
111    
112        @Override
113        public void fatalError(@NotNull SAXParseException e) throws SAXException {
114            getDelegate().fatalError(e);
115        }
116    }