View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   */
17  package javax.xml.bind;
18  
19  import java.io.File;
20  import java.io.InputStream;
21  import java.io.Reader;
22  import java.net.URL;
23  
24  import javax.xml.bind.annotation.adapters.XmlAdapter;
25  import javax.xml.bind.attachment.AttachmentUnmarshaller;
26  import javax.xml.validation.Schema;
27  import javax.xml.transform.Source;
28  import javax.xml.stream.XMLEventReader;
29  import javax.xml.stream.XMLStreamReader;
30  
31  import org.w3c.dom.Node;
32  
33  import org.xml.sax.InputSource;
34  
35  public interface Unmarshaller {
36  
37      abstract class Listener {
38          public void beforeUnmarshal(Object target, Object parent) {
39          }
40          public void afterUnmarshal(Object target, Object parent) {
41          }
42      }
43  
44      <A extends XmlAdapter> A getAdapter(Class<A> type);
45  
46      AttachmentUnmarshaller getAttachmentUnmarshaller();
47  
48      ValidationEventHandler getEventHandler() throws JAXBException;
49  
50      Listener getListener();
51  
52      Object getProperty(String name) throws PropertyException;
53  
54      Schema getSchema();
55  
56      UnmarshallerHandler getUnmarshallerHandler();
57  
58      boolean isValidating() throws JAXBException;
59  
60      <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter);
61  
62      void setAdapter(XmlAdapter adapter);
63  
64      void setAttachmentUnmarshaller(AttachmentUnmarshaller au);
65  
66      void setEventHandler(ValidationEventHandler handler) throws JAXBException;
67  
68      void setListener(Listener listener);
69  
70      void setProperty(String name, Object value) throws PropertyException;
71  
72      void setSchema(Schema schema);
73  
74      void setValidating(boolean validating) throws JAXBException;
75  
76      Object unmarshal(File f) throws JAXBException;
77  
78      Object unmarshal(InputSource source) throws JAXBException;
79  
80      Object unmarshal(InputStream is) throws JAXBException;
81  
82      Object unmarshal(Node node) throws JAXBException;
83  
84      <T> JAXBElement<T> unmarshal(Node node, Class<T> declaredType) throws JAXBException;
85  
86      Object unmarshal(Reader reader) throws JAXBException;
87  
88      Object unmarshal(Source source) throws JAXBException;
89  
90      <T> JAXBElement<T> unmarshal(Source source, Class<T> declaredType) throws JAXBException;
91  
92      Object unmarshal(URL url) throws JAXBException;
93  
94      Object unmarshal(XMLEventReader reader) throws JAXBException;
95  
96      <T> JAXBElement<T> unmarshal(XMLEventReader reader, Class<T> declaredType) throws JAXBException;
97  
98      Object unmarshal(XMLStreamReader reader) throws JAXBException;
99  
100     <T> JAXBElement<T> unmarshal(XMLStreamReader reader, Class<T> declaredType) throws JAXBException;
101 
102 }