List of utility methods to do XML JAXB Context
JAXBContext | getJaxbContext(Class... classes) get Jaxb Context try { return JAXBContext.newInstance(classes); } catch (JAXBException e) { throw new RuntimeException(e.getMessage(), e); |
JAXBContext | getJaxbContext(Class... classTypes) Get JAXBContext retObj = null; String key = ""; for (Class classType : classTypes) { if (!"".equals(key)) { key += ";"; key += classType.getName(); retObj = jaxbContextMap.get(key); if (retObj == null) { retObj = JAXBContext.newInstance(classTypes); jaxbContextMap.put(key, retObj); return retObj; |
JAXBContext | getJAXBContext(Class> clazz) get JAXB Context String clazzName = clazz.getName(); JAXBContext jx = jaxbContextHash.get(clazzName); if (jx == null) { jx = JAXBContext.newInstance(clazz); jaxbContextHash.put(clazzName, jx); return jx; |
JAXBContext | getJAXBContext(Class> clazz) get JAXB Context Map<String, JAXBContext> cache = threadLocal.get(); JAXBContext jc = cache.get(clazz.getName()); if (jc == null) { jc = JAXBContext.newInstance(clazz); cache.put(clazz.getName(), jc); return jc; |
JAXBContext | getJaxbContext(Class> clazz) get Jaxb Context JAXBContext jaxbContext = jaxbMap.get(clazz); if (jaxbContext == null) { try { jaxbContext = JAXBContext.newInstance(clazz); jaxbMap.putIfAbsent(clazz, jaxbContext); } catch (JAXBException ex) { throw new RuntimeException("Could not instantiate JAXBContext.", ex); return jaxbContext; |
JAXBContext | getJAXBContext(Class> clazz) get JAXB Context if (CTX_CACHE.containsKey(clazz)) { return CTX_CACHE.get(clazz); } else { JAXBContext ctx = JAXBContext.newInstance(clazz); CTX_CACHE.put(clazz, ctx); return ctx; |
JAXBContext | getJAXBContext(Class> objclass) Serialise the object to an XML string JAXBContext jaxbContext; if (jaxbContentCache.containsKey(objclass.getName())) { jaxbContext = jaxbContentCache.get(objclass.getName()); } else { jaxbContext = JAXBContext.newInstance(objclass); jaxbContentCache.put(objclass.getName(), jaxbContext); return jaxbContext; ... |
JAXBContext | getJaxbContext(Class> valueType) get Jaxb Context JAXBContext jaxbContext = JAXB_CONTEXTS.get(valueType.getPackage()); if (jaxbContext == null) { jaxbContext = JAXB_CONTEXTS.get(valueType); if (jaxbContext == null) { try { jaxbContext = JAXBContext.newInstance(valueType.getPackage().getName()); } catch (JAXBException e) { ... |
JAXBContext | getJaxbContext(String contextPath) Returns a JAXB context for the given context path. JAXBContext ctx = (JAXBContext) JAXB_CONTEXT_MAP.get(contextPath); if (ctx == null) { ctx = JAXBContext.newInstance(contextPath); JAXB_CONTEXT_MAP.put(contextPath, ctx); return ctx; |
JAXBContext | getJAXBContext(String contextPath) get JAXB Context if (contextCache.containsKey(contextPath)) { return contextCache.get(contextPath); } else { final JAXBContext context = JAXBContext.newInstance(contextPath); contextCache.put(contextPath, context); return context; |