Here you can find the source of getJAXBContext(String contextPath)
public static JAXBContext getJAXBContext(String contextPath) throws JAXBException
//package com.java2s; //License from project: Open Source License import java.util.HashMap; import java.util.Map; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; public class Main { private static Map<String, JAXBContext> contextCache = new HashMap<String, JAXBContext>(); public static JAXBContext getJAXBContext(String contextPath) throws JAXBException { if (contextCache.containsKey(contextPath)) { return contextCache.get(contextPath); } else {/*from w w w . ja v a2s .c o m*/ final JAXBContext context = JAXBContext.newInstance(contextPath); contextCache.put(contextPath, context); return context; } } }