001package org.kuali.ole.docstore.discovery.circulation; 002 003import javax.xml.bind.JAXBContext; 004import javax.xml.bind.JAXBException; 005import java.util.HashMap; 006import java.util.Map; 007 008/** 009 * Created with IntelliJ IDEA. 010 * User: pvsubrah 011 * Date: 5/22/13 012 * Time: 10:36 AM 013 * To change this template use File | Settings | File Templates. 014 */ 015public class JAXBContextFactory { 016 private static Map<Class, JAXBContext> map = new HashMap<Class, JAXBContext>(); 017 018 public synchronized static JAXBContext getJAXBContextForClass(Class clazz) { 019 if (!map.containsKey(clazz)) { 020 try { 021 map.put(clazz, JAXBContext.newInstance(clazz)); 022 } catch (JAXBException e) { 023 e.printStackTrace(); 024 } 025 } 026 return map.get(clazz); 027 } 028}