1 package org.kuali.ole.docstore.discovery.circulation;
2
3 import javax.xml.bind.JAXBContext;
4 import javax.xml.bind.JAXBException;
5 import java.util.HashMap;
6 import java.util.Map;
7
8
9
10
11
12
13
14
15 public class JAXBContextFactory {
16 private static Map<Class, JAXBContext> map = new HashMap<Class, JAXBContext>();
17
18 public synchronized static JAXBContext getJAXBContextForClass(Class clazz) {
19 if (!map.containsKey(clazz)) {
20 try {
21 map.put(clazz, JAXBContext.newInstance(clazz));
22 } catch (JAXBException e) {
23 e.printStackTrace();
24 }
25 }
26 return map.get(clazz);
27 }
28 }