Java XML JAXB Context getContext(Class c)

Here you can find the source of getContext(Class c)

Description

get Context

License

Open Source License

Declaration

private static JAXBContext getContext(Class<?> c) throws JAXBException 

Method Source Code

//package com.java2s;
//## The MIT License

import java.util.concurrent.ConcurrentHashMap;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;

public class Main {
    private static ConcurrentHashMap<Class<?>, JAXBContext> contextMap = new ConcurrentHashMap<Class<?>, JAXBContext>();

    private static JAXBContext getContext(Class<?> c) throws JAXBException {
        JAXBContext jc = contextMap.get(c);
        if (jc == null) {
            jc = JAXBContext.newInstance(c);
            contextMap.put(c, jc);/*ww  w.  ja va 2 s . c  o  m*/
        }

        return jc;
    }
}

Related

  1. getCachedContext(String pkg)
  2. getContext()
  3. getContext()
  4. getContext()
  5. getContext()
  6. getContext(Class clazz)
  7. getContext(final Class theClass)
  8. getContext(String uddiVersion)
  9. getContextFor(final Class clazz)