1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package javax.xml.bind;
18
19 import java.io.IOException;
20
21 import java.util.Map;
22 import java.util.Collections;
23
24 import org.w3c.dom.Node;
25
26 public abstract class JAXBContext {
27
28 public static final String JAXB_CONTEXT_FACTORY = "javax.xml.bind.context.factory";
29
30 protected JAXBContext() {
31 }
32
33 public Binder<Node> createBinder() {
34 throw new UnsupportedOperationException();
35 }
36
37 public <T> Binder<T> createBinder(Class<T> domType) {
38 throw new UnsupportedOperationException();
39 }
40
41 public JAXBIntrospector createJAXBIntrospector() {
42 throw new UnsupportedOperationException();
43 }
44
45 public abstract Marshaller createMarshaller() throws JAXBException;
46
47 public abstract Unmarshaller createUnmarshaller() throws JAXBException;
48
49 public abstract Validator createValidator() throws JAXBException;
50
51 public void generateSchema(SchemaOutputResolver resolver) throws IOException {
52 throw new UnsupportedOperationException();
53 }
54
55 public static JAXBContext newInstance(Class... classesToBeBound) throws JAXBException {
56 return newInstance(classesToBeBound, Collections.<String, Object>emptyMap());
57 }
58
59 public static JAXBContext newInstance(Class[] classesToBeBound, Map<String, ?> properties) throws JAXBException {
60 for (Class cl : classesToBeBound) {
61 if (cl == null) {
62 throw new IllegalArgumentException();
63 }
64 }
65 return ContextFinder.find(classesToBeBound, properties);
66 }
67
68 public static JAXBContext newInstance(String contextPath) throws JAXBException {
69 return newInstance(contextPath, Thread.currentThread().getContextClassLoader());
70 }
71
72 public static JAXBContext newInstance(String contextPath, ClassLoader classLoader) throws JAXBException {
73 return newInstance(contextPath, classLoader, Collections.<String, Object>emptyMap());
74 }
75
76 public static JAXBContext newInstance(String contextPath, ClassLoader classLoader, Map<String, ?> properties) throws JAXBException {
77 return ContextFinder.find(contextPath, classLoader, properties);
78 }
79 }