Java XML JAXB Context getJAXBContext(String contextPath)

Here you can find the source of getJAXBContext(String contextPath)

Description

get JAXB Context

License

Open Source License

Declaration

public static JAXBContext getJAXBContext(String contextPath) throws JAXBException 

Method Source Code

//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;
        }
    }
}

Related

  1. getJaxbContext(Class clazz)
  2. getJAXBContext(Class clazz)
  3. getJAXBContext(Class objclass)
  4. getJaxbContext(Class valueType)
  5. getJaxbContext(String contextPath)
  6. getJAXBContext(String namespaces)
  7. getJAXBContext(String packagePrefix)
  8. getJAXBContextForWebService(Class webService)
  9. getRequestContext()