001: /*
002: * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Scott Ferguson
028: */
029:
030: package javax.xml.bind;
031:
032: import org.w3c.dom.Node;
033: import org.xml.sax.InputSource;
034:
035: import javax.xml.bind.annotation.adapters.XmlAdapter;
036: import javax.xml.bind.attachment.AttachmentUnmarshaller;
037: import javax.xml.stream.XMLEventReader;
038: import javax.xml.stream.XMLStreamReader;
039: import javax.xml.transform.Source;
040: import javax.xml.validation.Schema;
041: import java.io.File;
042: import java.io.InputStream;
043: import java.io.Reader;
044: import java.net.URL;
045:
046: public interface Unmarshaller {
047:
048: <A extends XmlAdapter> A getAdapter(Class<A> type);
049:
050: AttachmentUnmarshaller getAttachmentUnmarshaller();
051:
052: ValidationEventHandler getEventHandler() throws JAXBException;
053:
054: Listener getListener();
055:
056: Object getProperty(String name) throws PropertyException;
057:
058: Schema getSchema();
059:
060: UnmarshallerHandler getUnmarshallerHandler();
061:
062: boolean isValidating() throws JAXBException;
063:
064: <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter);
065:
066: void setAdapter(XmlAdapter adapter);
067:
068: void setAttachmentUnmarshaller(AttachmentUnmarshaller au);
069:
070: void setEventHandler(ValidationEventHandler handler)
071: throws JAXBException;
072:
073: void setListener(Listener listener);
074:
075: void setProperty(String name, Object value)
076: throws PropertyException;
077:
078: void setSchema(Schema schema);
079:
080: void setValidating(boolean validating) throws JAXBException;
081:
082: Object unmarshal(File f) throws JAXBException;
083:
084: Object unmarshal(InputSource source) throws JAXBException;
085:
086: Object unmarshal(InputStream is) throws JAXBException;
087:
088: Object unmarshal(Node node) throws JAXBException;
089:
090: <T> JAXBElement<T> unmarshal(Node node, Class<T> declaredType)
091: throws JAXBException;
092:
093: Object unmarshal(Reader reader) throws JAXBException;
094:
095: Object unmarshal(Source source) throws JAXBException;
096:
097: <T> JAXBElement<T> unmarshal(Source node, Class<T> declaredType)
098: throws JAXBException;
099:
100: Object unmarshal(URL url) throws JAXBException;
101:
102: Object unmarshal(XMLEventReader reader) throws JAXBException;
103:
104: <T> JAXBElement<T> unmarshal(XMLEventReader xmlEventReader,
105: Class<T> declaredType) throws JAXBException;
106:
107: Object unmarshal(XMLStreamReader reader) throws JAXBException;
108:
109: <T> JAXBElement<T> unmarshal(XMLStreamReader xmlStreamReader,
110: Class<T> declaredType) throws JAXBException;
111:
112: public static abstract class Listener {
113:
114: public Listener() {
115: }
116:
117: public void afterUnmarshal(Object target, Object parent) {
118: }
119:
120: public void beforeUnmarshal(Object target, Object parent) {
121: }
122:
123: }
124: }
|