com.sun.xml.internal.bind.api.JAXBRIContext Java Examples
The following examples show how to use
com.sun.xml.internal.bind.api.JAXBRIContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContextFactory.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * * @param classes * @param typeRefs * @param subclassReplacements * @param defaultNsUri * @param c14nSupport * @param ar * @param xmlAccessorFactorySupport * @param allNillable * @param retainPropertyInfo * @param improvedXsiTypeHandling * @return * @throws JAXBException * @deprecated use createContext( Class[] classes, Map<String,Object> properties) method instead */ @Deprecated public static JAXBRIContext createContext( Class[] classes, Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling) throws JAXBException { JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder(); builder.setClasses(classes); builder.setTypeRefs(typeRefs); builder.setSubclassReplacements(subclassReplacements); builder.setDefaultNsUri(defaultNsUri); builder.setC14NSupport(c14nSupport); builder.setAnnotationReader(ar); builder.setXmlAccessorFactorySupport(xmlAccessorFactorySupport); builder.setAllNillable(allNillable); builder.setRetainPropertyInfo(retainPropertyInfo); builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling); return builder.build(); }
Example #2
Source File: ContextFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * * @param classes * @param typeRefs * @param subclassReplacements * @param defaultNsUri * @param c14nSupport * @param ar * @param xmlAccessorFactorySupport * @param allNillable * @param retainPropertyInfo * @param improvedXsiTypeHandling * @return * @throws JAXBException * @deprecated use createContext( Class[] classes, Map<String,Object> properties) method instead */ @Deprecated public static JAXBRIContext createContext( Class[] classes, Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling) throws JAXBException { JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder(); builder.setClasses(classes); builder.setTypeRefs(typeRefs); builder.setSubclassReplacements(subclassReplacements); builder.setDefaultNsUri(defaultNsUri); builder.setC14NSupport(c14nSupport); builder.setAnnotationReader(ar); builder.setXmlAccessorFactorySupport(xmlAccessorFactorySupport); builder.setAllNillable(allNillable); builder.setRetainPropertyInfo(retainPropertyInfo); builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling); return builder.build(); }
Example #3
Source File: ContextFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * * @param classes * @param typeRefs * @param subclassReplacements * @param defaultNsUri * @param c14nSupport * @param ar * @param xmlAccessorFactorySupport * @param allNillable * @param retainPropertyInfo * @param improvedXsiTypeHandling * @return * @throws JAXBException * @deprecated use createContext( Class[] classes, Map<String,Object> properties) method instead */ @Deprecated public static JAXBRIContext createContext( Class[] classes, Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling) throws JAXBException { JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder(); builder.setClasses(classes); builder.setTypeRefs(typeRefs); builder.setSubclassReplacements(subclassReplacements); builder.setDefaultNsUri(defaultNsUri); builder.setC14NSupport(c14nSupport); builder.setAnnotationReader(ar); builder.setXmlAccessorFactorySupport(xmlAccessorFactorySupport); builder.setAllNillable(allNillable); builder.setRetainPropertyInfo(retainPropertyInfo); builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling); return builder.build(); }
Example #4
Source File: ContextFactory.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * * @param classes * @param typeRefs * @param subclassReplacements * @param defaultNsUri * @param c14nSupport * @param ar * @param xmlAccessorFactorySupport * @param allNillable * @param retainPropertyInfo * @param improvedXsiTypeHandling * @return * @throws JAXBException * @deprecated use createContext( Class[] classes, Map<String,Object> properties) method instead */ @Deprecated public static JAXBRIContext createContext( Class[] classes, Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling) throws JAXBException { JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder(); builder.setClasses(classes); builder.setTypeRefs(typeRefs); builder.setSubclassReplacements(subclassReplacements); builder.setDefaultNsUri(defaultNsUri); builder.setC14NSupport(c14nSupport); builder.setAnnotationReader(ar); builder.setXmlAccessorFactorySupport(xmlAccessorFactorySupport); builder.setAllNillable(allNillable); builder.setRetainPropertyInfo(retainPropertyInfo); builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling); return builder.build(); }
Example #5
Source File: ContextFactory.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * * @param classes * @param typeRefs * @param subclassReplacements * @param defaultNsUri * @param c14nSupport * @param ar * @param xmlAccessorFactorySupport * @param allNillable * @param retainPropertyInfo * @param improvedXsiTypeHandling * @return * @throws JAXBException * @deprecated use createContext( Class[] classes, Map<String,Object> properties) method instead */ @Deprecated public static JAXBRIContext createContext( Class[] classes, Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling) throws JAXBException { JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder(); builder.setClasses(classes); builder.setTypeRefs(typeRefs); builder.setSubclassReplacements(subclassReplacements); builder.setDefaultNsUri(defaultNsUri); builder.setC14NSupport(c14nSupport); builder.setAnnotationReader(ar); builder.setXmlAccessorFactorySupport(xmlAccessorFactorySupport); builder.setAllNillable(allNillable); builder.setRetainPropertyInfo(retainPropertyInfo); builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling); return builder.build(); }
Example #6
Source File: ContextFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * * @param classes * @param typeRefs * @param subclassReplacements * @param defaultNsUri * @param c14nSupport * @param ar * @param xmlAccessorFactorySupport * @param allNillable * @param retainPropertyInfo * @param improvedXsiTypeHandling * @return * @throws JAXBException * @deprecated use {@code createContext( Class[] classes, Map<String,Object> properties)} method instead */ @Deprecated public static JAXBRIContext createContext( Class[] classes, Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling) throws JAXBException { JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder(); builder.setClasses(classes); builder.setTypeRefs(typeRefs); builder.setSubclassReplacements(subclassReplacements); builder.setDefaultNsUri(defaultNsUri); builder.setC14NSupport(c14nSupport); builder.setAnnotationReader(ar); builder.setXmlAccessorFactorySupport(xmlAccessorFactorySupport); builder.setAllNillable(allNillable); builder.setRetainPropertyInfo(retainPropertyInfo); builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling); return builder.build(); }
Example #7
Source File: ContextFactory.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * * @param classes * @param typeRefs * @param subclassReplacements * @param defaultNsUri * @param c14nSupport * @param ar * @param xmlAccessorFactorySupport * @param allNillable * @param retainPropertyInfo * @param improvedXsiTypeHandling * @return * @throws JAXBException * @deprecated use createContext( Class[] classes, Map<String,Object> properties) method instead */ @Deprecated public static JAXBRIContext createContext( Class[] classes, Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling) throws JAXBException { JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder(); builder.setClasses(classes); builder.setTypeRefs(typeRefs); builder.setSubclassReplacements(subclassReplacements); builder.setDefaultNsUri(defaultNsUri); builder.setC14NSupport(c14nSupport); builder.setAnnotationReader(ar); builder.setXmlAccessorFactorySupport(xmlAccessorFactorySupport); builder.setAllNillable(allNillable); builder.setRetainPropertyInfo(retainPropertyInfo); builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling); return builder.build(); }
Example #8
Source File: JAXBRIContextFactory.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public BindingContext newContext(BindingInfo bi) { Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]); for (int i = 0; i < classes.length; i++) { if (WrapperComposite.class.equals(classes[i])) { classes[i] = CompositeStructure.class; } } Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos()); Map<Class, Class> subclassReplacements = bi.subclassReplacements(); String defaultNamespaceRemap = bi.getDefaultNamespace(); Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport"); RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader"); JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName()); try { JAXBRIContext context = (jaxbContextFactory != null) ? jaxbContextFactory.createJAXBContext( bi.getSEIModel(), toList(classes), toList(typeInfoMappings.values())) : ContextFactory.createContext( classes, typeInfoMappings.values(), subclassReplacements, defaultNamespaceRemap, (c14nSupport != null) ? c14nSupport : false, ar, false, false, false); return new JAXBRIContextWrapper(context, typeInfoMappings); } catch (Exception e) { throw new DatabindingException(e); } }
Example #9
Source File: JAXBDispatch.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void setOutboundHeaders(Object... headers) { if (headers == null) throw new IllegalArgumentException(); Header[] hl = new Header[headers.length]; for (int i = 0; i < hl.length; i++) { if (headers[i] == null) throw new IllegalArgumentException(); // TODO: handle any JAXBContext. hl[i] = Headers.create((JAXBRIContext) jaxbcontext, headers[i]); } super.setOutboundHeaders(hl); }
Example #10
Source File: JAXBRIContextWrapper.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
JAXBRIContextWrapper(JAXBRIContext cxt, Map<TypeInfo, TypeReference> refs) { context = cxt; typeRefs = refs; if (refs != null) { typeInfos = new java.util.HashMap<TypeReference, TypeInfo>(); for (TypeInfo ti : refs.keySet()) { typeInfos.put(typeRefs.get(ti), ti); } } }
Example #11
Source File: JAXBRIContextWrapper.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
JAXBRIContextWrapper(JAXBRIContext cxt, Map<TypeInfo, TypeReference> refs) { context = cxt; typeRefs = refs; if (refs != null) { typeInfos = new java.util.HashMap<TypeReference, TypeInfo>(); for (TypeInfo ti : refs.keySet()) { typeInfos.put(typeRefs.get(ti), ti); } } }
Example #12
Source File: ExternalMetadataReader.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static JAXBContext createJaxbContext(boolean disableXmlSecurity) { Class[] cls = {ObjectFactory.class}; try { if (disableXmlSecurity) { Map<String, Object> properties = new HashMap<String, Object>(); properties.put(JAXBRIContext.DISABLE_XML_SECURITY, disableXmlSecurity); return JAXBContext.newInstance(cls, properties); } else { return JAXBContext.newInstance(cls); } } catch (JAXBException e) { e.printStackTrace(); return null; } }
Example #13
Source File: JAXBRIContextFactory.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public BindingContext newContext(BindingInfo bi) { Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]); for (int i = 0; i < classes.length; i++) { if (WrapperComposite.class.equals(classes[i])) { classes[i] = CompositeStructure.class; } } Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos()); Map<Class, Class> subclassReplacements = bi.subclassReplacements(); String defaultNamespaceRemap = bi.getDefaultNamespace(); Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport"); RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader"); JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName()); try { JAXBRIContext context = (jaxbContextFactory != null) ? jaxbContextFactory.createJAXBContext( bi.getSEIModel(), toList(classes), toList(typeInfoMappings.values())) : ContextFactory.createContext( classes, typeInfoMappings.values(), subclassReplacements, defaultNamespaceRemap, (c14nSupport != null) ? c14nSupport : false, ar, false, false, false); return new JAXBRIContextWrapper(context, typeInfoMappings); } catch (Exception e) { throw new DatabindingException(e); } }
Example #14
Source File: UsesJAXBContextFeature.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates {@link UsesJAXBContextFeature}. * This version allows you to create {@link JAXBRIContext} upfront and uses it. */ public UsesJAXBContextFeature(@Nullable final JAXBRIContext context) { this.factory = new JAXBContextFactory() { @NotNull public JAXBRIContext createJAXBContext(@NotNull SEIModel sei, @NotNull List<Class> classesToBind, @NotNull List<TypeReference> typeReferences) throws JAXBException { return context; } }; }
Example #15
Source File: JAXBRIContextFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public BindingContext newContext(BindingInfo bi) { Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]); for (int i = 0; i < classes.length; i++) { if (WrapperComposite.class.equals(classes[i])) { classes[i] = CompositeStructure.class; } } Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos()); Map<Class, Class> subclassReplacements = bi.subclassReplacements(); String defaultNamespaceRemap = bi.getDefaultNamespace(); Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport"); RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader"); JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName()); try { JAXBRIContext context = (jaxbContextFactory != null) ? jaxbContextFactory.createJAXBContext( bi.getSEIModel(), toList(classes), toList(typeInfoMappings.values())) : ContextFactory.createContext( classes, typeInfoMappings.values(), subclassReplacements, defaultNamespaceRemap, (c14nSupport != null) ? c14nSupport : false, ar, false, false, false); return new JAXBRIContextWrapper(context, typeInfoMappings); } catch (Exception e) { throw new DatabindingException(e); } }
Example #16
Source File: JAXBRIContextFactory.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public BindingContext newContext(BindingInfo bi) { Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]); for (int i = 0; i < classes.length; i++) { if (WrapperComposite.class.equals(classes[i])) { classes[i] = CompositeStructure.class; } } Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos()); Map<Class, Class> subclassReplacements = bi.subclassReplacements(); String defaultNamespaceRemap = bi.getDefaultNamespace(); Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport"); RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader"); JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName()); try { JAXBRIContext context = (jaxbContextFactory != null) ? jaxbContextFactory.createJAXBContext( bi.getSEIModel(), toList(classes), toList(typeInfoMappings.values())) : ContextFactory.createContext( classes, typeInfoMappings.values(), subclassReplacements, defaultNamespaceRemap, (c14nSupport != null) ? c14nSupport : false, ar, false, false, false); return new JAXBRIContextWrapper(context, typeInfoMappings); } catch (Exception e) { throw new DatabindingException(e); } }
Example #17
Source File: UsesJAXBContextFeature.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Creates {@link UsesJAXBContextFeature}. * This version allows you to create {@link JAXBRIContext} upfront and uses it. */ public UsesJAXBContextFeature(@Nullable final JAXBRIContext context) { this.factory = new JAXBContextFactory() { @NotNull public JAXBRIContext createJAXBContext(@NotNull SEIModel sei, @NotNull List<Class> classesToBind, @NotNull List<TypeReference> typeReferences) throws JAXBException { return context; } }; }
Example #18
Source File: UsesJAXBContextFeature.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Creates {@link UsesJAXBContextFeature}. * This version allows you to create {@link JAXBRIContext} upfront and uses it. */ public UsesJAXBContextFeature(@Nullable final JAXBRIContext context) { this.factory = new JAXBContextFactory() { @NotNull public JAXBRIContext createJAXBContext(@NotNull SEIModel sei, @NotNull List<Class> classesToBind, @NotNull List<TypeReference> typeReferences) throws JAXBException { return context; } }; }
Example #19
Source File: JAXBDispatch.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void setOutboundHeaders(Object... headers) { if (headers == null) throw new IllegalArgumentException(); Header[] hl = new Header[headers.length]; for (int i = 0; i < hl.length; i++) { if (headers[i] == null) throw new IllegalArgumentException(); // TODO: handle any JAXBContext. hl[i] = Headers.create((JAXBRIContext) jaxbcontext, headers[i]); } super.setOutboundHeaders(hl); }
Example #20
Source File: ExternalMetadataReader.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static JAXBContext createJaxbContext(boolean disableXmlSecurity) { Class[] cls = {ObjectFactory.class}; try { if (disableXmlSecurity) { Map<String, Object> properties = new HashMap<String, Object>(); properties.put(JAXBRIContext.DISABLE_XML_SECURITY, disableXmlSecurity); return JAXBContext.newInstance(cls, properties); } else { return JAXBContext.newInstance(cls); } } catch (JAXBException e) { e.printStackTrace(); return null; } }
Example #21
Source File: ExternalMetadataReader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static JAXBContext createJaxbContext(boolean disableXmlSecurity) { Class[] cls = {ObjectFactory.class}; try { if (disableXmlSecurity) { Map<String, Object> properties = new HashMap<String, Object>(); properties.put(JAXBRIContext.DISABLE_XML_SECURITY, disableXmlSecurity); return JAXBContext.newInstance(cls, properties); } else { return JAXBContext.newInstance(cls); } } catch (JAXBException e) { e.printStackTrace(); return null; } }
Example #22
Source File: JAXBRIContextFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public BindingContext newContext(BindingInfo bi) { Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]); for (int i = 0; i < classes.length; i++) { if (WrapperComposite.class.equals(classes[i])) { classes[i] = CompositeStructure.class; } } Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos()); Map<Class, Class> subclassReplacements = bi.subclassReplacements(); String defaultNamespaceRemap = bi.getDefaultNamespace(); Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport"); RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader"); JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName()); try { JAXBRIContext context = (jaxbContextFactory != null) ? jaxbContextFactory.createJAXBContext( bi.getSEIModel(), toList(classes), toList(typeInfoMappings.values())) : ContextFactory.createContext( classes, typeInfoMappings.values(), subclassReplacements, defaultNamespaceRemap, (c14nSupport != null) ? c14nSupport : false, ar, false, false, false); return new JAXBRIContextWrapper(context, typeInfoMappings); } catch (Exception e) { throw new DatabindingException(e); } }
Example #23
Source File: JAXBRIContextWrapper.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
JAXBRIContextWrapper(JAXBRIContext cxt, Map<TypeInfo, TypeReference> refs) { context = cxt; typeRefs = refs; if (refs != null) { typeInfos = new java.util.HashMap<TypeReference, TypeInfo>(); for (TypeInfo ti : refs.keySet()) { typeInfos.put(typeRefs.get(ti), ti); } } }
Example #24
Source File: UsesJAXBContextFeature.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Creates {@link UsesJAXBContextFeature}. * This version allows you to create {@link JAXBRIContext} upfront and uses it. */ public UsesJAXBContextFeature(@Nullable final JAXBRIContext context) { this.factory = new JAXBContextFactory() { @NotNull public JAXBRIContext createJAXBContext(@NotNull SEIModel sei, @NotNull List<Class> classesToBind, @NotNull List<TypeReference> typeReferences) throws JAXBException { return context; } }; }
Example #25
Source File: UsesJAXBContextFeature.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates {@link UsesJAXBContextFeature}. * This version allows you to create {@link JAXBRIContext} upfront and uses it. */ public UsesJAXBContextFeature(@Nullable final JAXBRIContext context) { this.factory = new JAXBContextFactory() { @NotNull public JAXBRIContext createJAXBContext(@NotNull SEIModel sei, @NotNull List<Class> classesToBind, @NotNull List<TypeReference> typeReferences) throws JAXBException { return context; } }; }
Example #26
Source File: JAXBRIContextFactory.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public BindingContext newContext(BindingInfo bi) { Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]); for (int i = 0; i < classes.length; i++) { if (WrapperComposite.class.equals(classes[i])) { classes[i] = CompositeStructure.class; } } Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos()); Map<Class, Class> subclassReplacements = bi.subclassReplacements(); String defaultNamespaceRemap = bi.getDefaultNamespace(); Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport"); RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader"); JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName()); try { JAXBRIContext context = (jaxbContextFactory != null) ? jaxbContextFactory.createJAXBContext( bi.getSEIModel(), toList(classes), toList(typeInfoMappings.values())) : ContextFactory.createContext( classes, typeInfoMappings.values(), subclassReplacements, defaultNamespaceRemap, (c14nSupport != null) ? c14nSupport : false, ar, false, false, false); return new JAXBRIContextWrapper(context, typeInfoMappings); } catch (Exception e) { throw new DatabindingException(e); } }
Example #27
Source File: ExternalMetadataReader.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static JAXBContext createJaxbContext(boolean disableXmlSecurity) { Class[] cls = {ObjectFactory.class}; try { if (disableXmlSecurity) { Map<String, Object> properties = new HashMap<String, Object>(); properties.put(JAXBRIContext.DISABLE_XML_SECURITY, disableXmlSecurity); return JAXBContext.newInstance(cls, properties); } else { return JAXBContext.newInstance(cls); } } catch (JAXBException e) { e.printStackTrace(); return null; } }
Example #28
Source File: UsesJAXBContextFeature.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Creates {@link UsesJAXBContextFeature}. * This version allows you to create {@link JAXBRIContext} upfront and uses it. */ public UsesJAXBContextFeature(@Nullable final JAXBRIContext context) { this.factory = new JAXBContextFactory() { @NotNull public JAXBRIContext createJAXBContext(@NotNull SEIModel sei, @NotNull List<Class> classesToBind, @NotNull List<TypeReference> typeReferences) throws JAXBException { return context; } }; }
Example #29
Source File: JAXBRIContextFactory.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public BindingContext newContext(BindingInfo bi) { Class[] classes = bi.contentClasses().toArray(new Class[bi.contentClasses().size()]); for (int i = 0; i < classes.length; i++) { if (WrapperComposite.class.equals(classes[i])) { classes[i] = CompositeStructure.class; } } Map<TypeInfo, TypeReference> typeInfoMappings = typeInfoMappings(bi.typeInfos()); Map<Class, Class> subclassReplacements = bi.subclassReplacements(); String defaultNamespaceRemap = bi.getDefaultNamespace(); Boolean c14nSupport = (Boolean) bi.properties().get("c14nSupport"); RuntimeAnnotationReader ar = (RuntimeAnnotationReader) bi.properties().get("com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader"); JAXBContextFactory jaxbContextFactory = (JAXBContextFactory) bi.properties().get(JAXBContextFactory.class.getName()); try { JAXBRIContext context = (jaxbContextFactory != null) ? jaxbContextFactory.createJAXBContext( bi.getSEIModel(), toList(classes), toList(typeInfoMappings.values())) : ContextFactory.createContext( classes, typeInfoMappings.values(), subclassReplacements, defaultNamespaceRemap, (c14nSupport != null) ? c14nSupport : false, ar, false, false, false); return new JAXBRIContextWrapper(context, typeInfoMappings); } catch (Exception e) { throw new DatabindingException(e); } }
Example #30
Source File: ExternalMetadataReader.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static JAXBContext createJaxbContext(boolean disableXmlSecurity) { Class[] cls = {ObjectFactory.class}; try { if (disableXmlSecurity) { Map<String, Object> properties = new HashMap<String, Object>(); properties.put(JAXBRIContext.DISABLE_XML_SECURITY, disableXmlSecurity); return JAXBContext.newInstance(cls, properties); } else { return JAXBContext.newInstance(cls); } } catch (JAXBException e) { e.printStackTrace(); return null; } }