Java Utililty Methods XML JAXB Context

List of utility methods to do XML JAXB Context

Description

The list of methods to do XML JAXB Context are organized into topic(s).

Method

JAXBContextgetContext()
Returns the JAXB context for XML parsing / generation.
if (JAXB == null)
    initContext(Thread.currentThread().getContextClassLoader());
return JAXB;
JAXBContextgetContext(Class c)
get Context
JAXBContext jc = contextMap.get(c);
if (jc == null) {
    jc = JAXBContext.newInstance(c);
    contextMap.put(c, jc);
return jc;
JAXBContextgetContext(Class clazz)
get Context
JAXBContext context = CONTEXTS.get(clazz);
if (context == null) {
    try {
        context = JAXBContext.newInstance(clazz);
    } catch (JAXBException e) {
        throw new RuntimeException("Failed to create JAXBContext for type " + clazz, e);
    CONTEXTS.put(clazz, context);
...
JAXBContextgetContext(final Class theClass)
Gets the JAXBContext for the passed in class.
if (serMap.containsKey(theClass)) {
    return serMap.get(theClass);
} else {
    final JAXBContext jContext = JAXBContext.newInstance(theClass);
    serMap.put(theClass, jContext);
    return jContext;
JAXBContextgetContext(String uddiVersion)
get Context
return JAXBContexts.get(uddiVersion);
JAXBContextgetContextFor(final Class clazz)
get Context For
final JAXBContext context;
if (m_contexts.containsKey(clazz)) {
    context = m_contexts.get(clazz);
} else {
    context = JAXBContext.newInstance(clazz);
    m_contexts.put(clazz, context);
return context;
...
JAXBContextgetContextForNamespace(String namespace)
get Context For Namespace
String contextPath = namespaceToContextPath.get(namespace);
if (contextPath == null) {
    contextPath = namespaceToContextPath.get(DEFAULT_NAMESPACE);
return JAXBContext.newInstance(contextPath);
StringgetContextPath(Class... classes)
get Context Path
if (classes == null) {
    throw new IllegalArgumentException("The validated object is null");
for (int i = 0; i < classes.length; i++) {
    if (classes[i] == null) {
        throw new IllegalArgumentException("The validated array contains null element at index: " + i);
final StringBuilder contextPath = new StringBuilder();
for (int index = 0; index < classes.length; index++) {
    if (index > 0) {
        contextPath.append(':');
    contextPath.append(classes[index].getPackage().getName());
return contextPath.toString();
JAXBContextgetCustomContext()
get Custom Context
return jaxbContext;
JAXBContextgetCustomIdentityJAXBContext()
get Custom Identity JAXB Context
initCustomJAXBContext();
return customjaxbContext;