001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    package javax.xml.bind;
018    
019    import java.io.File;
020    import java.io.InputStream;
021    import java.io.Reader;
022    import java.net.URL;
023    
024    import javax.xml.bind.annotation.adapters.XmlAdapter;
025    import javax.xml.bind.attachment.AttachmentUnmarshaller;
026    import javax.xml.validation.Schema;
027    import javax.xml.transform.Source;
028    import javax.xml.stream.XMLEventReader;
029    import javax.xml.stream.XMLStreamReader;
030    
031    import org.w3c.dom.Node;
032    
033    import org.xml.sax.InputSource;
034    
035    public interface Unmarshaller {
036    
037        abstract class Listener {
038            public void beforeUnmarshal(Object target, Object parent) {
039            }
040            public void afterUnmarshal(Object target, Object parent) {
041            }
042        }
043    
044        <A extends XmlAdapter> A getAdapter(Class<A> type);
045    
046        AttachmentUnmarshaller getAttachmentUnmarshaller();
047    
048        ValidationEventHandler getEventHandler() throws JAXBException;
049    
050        Listener getListener();
051    
052        Object getProperty(String name) throws PropertyException;
053    
054        Schema getSchema();
055    
056        UnmarshallerHandler getUnmarshallerHandler();
057    
058        boolean isValidating() throws JAXBException;
059    
060        <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter);
061    
062        void setAdapter(XmlAdapter adapter);
063    
064        void setAttachmentUnmarshaller(AttachmentUnmarshaller au);
065    
066        void setEventHandler(ValidationEventHandler handler) throws JAXBException;
067    
068        void setListener(Listener listener);
069    
070        void setProperty(String name, Object value) throws PropertyException;
071    
072        void setSchema(Schema schema);
073    
074        void setValidating(boolean validating) throws JAXBException;
075    
076        Object unmarshal(File f) throws JAXBException;
077    
078        Object unmarshal(InputSource source) throws JAXBException;
079    
080        Object unmarshal(InputStream is) throws JAXBException;
081    
082        Object unmarshal(Node node) throws JAXBException;
083    
084        <T> JAXBElement<T> unmarshal(Node node, Class<T> declaredType) throws JAXBException;
085    
086        Object unmarshal(Reader reader) throws JAXBException;
087    
088        Object unmarshal(Source source) throws JAXBException;
089    
090        <T> JAXBElement<T> unmarshal(Source source, Class<T> declaredType) throws JAXBException;
091    
092        Object unmarshal(URL url) throws JAXBException;
093    
094        Object unmarshal(XMLEventReader reader) throws JAXBException;
095    
096        <T> JAXBElement<T> unmarshal(XMLEventReader reader, Class<T> declaredType) throws JAXBException;
097    
098        Object unmarshal(XMLStreamReader reader) throws JAXBException;
099    
100        <T> JAXBElement<T> unmarshal(XMLStreamReader reader, Class<T> declaredType) throws JAXBException;
101    
102    }