01: /*
02: * Copyright 2005-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.springframework.oxm;
17:
18: import java.io.IOException;
19: import javax.xml.transform.Source;
20:
21: /**
22: * Defines the contract for Object XML Mapping unmarshallers.
23: * <p/>
24: * <p>Implementations of this interface can deserialize a given XML Stream to an Object graph.
25: *
26: * @author Arjen Poutsma
27: * @since 1.0.0
28: */
29: public interface Unmarshaller {
30:
31: /**
32: * Unmarshals the given {@link Source} into an object graph.
33: *
34: * @param source the source to marshal from
35: * @return the object graph
36: * @throws XmlMappingException if the given source cannot be mapped to an object
37: * @throws IOException if an I/O Exception occurs
38: */
39: Object unmarshal(Source source) throws XmlMappingException,
40: IOException;
41:
42: /**
43: * Indicates whether this unmarshaller can unmarshal instances of the supplied type.
44: *
45: * @param clazz the class that this unmarshaller is being asked if it can marshal
46: * @return <code>true</code> if this unmarshaller can indeed unmarshal to the supplied class; <code>false</code>
47: * otherwise
48: */
49: boolean supports(Class clazz);
50:
51: }
|