protected void marshalCollectionMember(Object obj, Class<?> cls, Type genericType, String enc, OutputStream os, Annotation[] anns, MediaType mt, String ns) throws Exception { //CHECKSTYLE:ON if (!(obj instanceof JAXBElement)) { obj = convertToJaxbElementIfNeeded(obj, cls, genericType); } if (obj instanceof JAXBElement && cls != JAXBElement.class) { cls = JAXBElement.class; } Marshaller ms = createMarshaller(obj, cls, genericType, enc); ms.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); if (ns.length() > 0) { Map<String, String> map = new HashMap<>(); // set the default just in case if (!nsPrefixes.containsKey(ns)) { map.put(ns, "ns1"); } map.putAll(nsPrefixes); setNamespaceMapper(ms, map); } marshal(obj, cls, genericType, enc, os, anns, mt, ms); }
obj = ((JAXBElement<?>)obj).getValue(); } else { obj = convertToJaxbElementIfNeeded(obj, cls, genericType);
protected void marshal(Object obj, Class<?> cls, Type genericType, String enc, OutputStream os, MediaType mt, Annotation[] anns) throws Exception { obj = convertToJaxbElementIfNeeded(obj, cls, genericType); if (obj instanceof JAXBElement && cls != JAXBElement.class) { cls = JAXBElement.class; } Marshaller ms = createMarshaller(obj, cls, genericType, enc); if (!nsPrefixes.isEmpty()) { setNamespaceMapper(ms, nsPrefixes); } addAttachmentMarshaller(ms); processXmlAnnotations(ms, mt, anns); marshal(obj, cls, genericType, enc, os, anns, mt, ms); }
protected void marshal(Object obj, Class<?> cls, Type genericType, String enc, OutputStream os, MediaType mt, Annotation[] anns) throws Exception { obj = convertToJaxbElementIfNeeded(obj, cls, genericType); if (obj instanceof JAXBElement && cls != JAXBElement.class) { cls = JAXBElement.class; } Marshaller ms = createMarshaller(obj, cls, genericType, enc); if (!nsPrefixes.isEmpty()) { setNamespaceMapper(ms, nsPrefixes); } addAttachmentMarshaller(ms); addProcessingInstructions(ms, anns); addSchemaLocation(ms, anns); marshal(obj, cls, genericType, enc, os, mt, ms); }