Package javax.xml.bind

Examples of javax.xml.bind.JAXBElement$GlobalScope


//        XMLStreamReader2String t2 = new XMLStreamReader2String();
//        String xml = t2.transform(reader, null);
        // System.out.println(xml);
        Object result = context.createUnmarshaller().unmarshal(reader, MyBean.class);
        assertTrue(result instanceof JAXBElement);
        JAXBElement e2 = (JAXBElement)result;
        assertTrue(e2.getValue() instanceof MyBean);
        MyBean newBean = (MyBean)e2.getValue();
        // FIXME :To be implemented
        // assertEquals(bean, newBean);
    }
View Full Code Here


        context.createMarshaller().marshal(element, writer);
        // System.out.println(writer.toString());

        Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
        assertTrue(result instanceof JAXBElement);
        JAXBElement e2 = (JAXBElement)result;
        assertEquals("ABC", e2.getValue());
    }
View Full Code Here

        context.createMarshaller().marshal(element, writer);
        // System.out.println(writer.toString());
        StreamSource source = new StreamSource(new StringReader(writer.toString()));
        Object result = context.createUnmarshaller().unmarshal(source, String.class);
        assertTrue(result instanceof JAXBElement);
        JAXBElement e2 = (JAXBElement)result;
        assertNull(e2.getValue());
    }
View Full Code Here

        context.createMarshaller().marshal(element, writer);
        // System.out.println(writer.toString());

        Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
        assertTrue(result instanceof JAXBElement);
        JAXBElement e2 = (JAXBElement)result;
        assertTrue(e2.getValue() instanceof String[]);
    }
View Full Code Here

        assertTrue(xml.contains("QUJD"));
        assertTrue(xml.contains("base64Binary"));

        Object result = context.createUnmarshaller().unmarshal(new StringReader(xml));
        assertTrue(result instanceof JAXBElement);
        JAXBElement e2 = (JAXBElement)result;
        assertTrue(e2.getValue() instanceof byte[]);
    }
View Full Code Here

        context.createMarshaller().marshal(element, writer);
        // System.out.println(writer.toString());

        Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
        assertTrue(result instanceof JAXBElement);
        JAXBElement e2 = (JAXBElement)result;
        assertEquals(1, e2.getValue());
    }
View Full Code Here

            Class cls = arg.getClass();
            if (arg instanceof JAXBElement) {
                isElement = true;
                cls = ((JAXBElement)arg).getDeclaredType();
            } else {
                arg = new JAXBElement(ROOT_ELEMENT, Object.class, arg);
            }
            JAXBContext context = JAXBContext.newInstance(cls);
            Document doc = DOMHelper.newDocument();
            context.createMarshaller().marshal(arg, doc);
            JAXBElement<?> element = context.createUnmarshaller().unmarshal(doc, cls);
View Full Code Here

                    type = Object.class;
                }
            } else {
                type = Object.class;
            }
            return new JAXBElement(elementName, type, value);
        }
    }
View Full Code Here

    void marshal(Exchange exchange, Object graph, OutputStream stream, Marshaller marshaller)
        throws XMLStreamException, JAXBException {

        Object e = graph;
        if (partialClass != null && getPartNamespace() != null) {
            e = new JAXBElement(getPartNamespace(), partialClass, graph);
        }

        if (needFiltering(exchange)) {
            marshaller.marshal(e, createFilteringWriter(stream));
        } else {
View Full Code Here

            // NOTE: [rfeng] We cannot wrap an element in a JAXBElement
            element = value;
        }
        if (element == null) {
            // For local elements, we still have to produce xsi:type
            element = new JAXBElement(name, Object.class, value);
        }
        return element;
    }
View Full Code Here

TOP

Related Classes of javax.xml.bind.JAXBElement$GlobalScope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.