Java 8 JAXBIntrospector - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 JAXBIntrospector class.

This code example shows how to use the following methods:getElementName
 
    private QName getElementName(Class<?> parameterType, Object param) {
        try { 
            JAXBContext context = JAXBContext.newInstance(parameterType);
            JAXBIntrospector introspector = context.createJAXBIntrospector();
            return introspector.getElementName(param);
        } 
        catch (JAXBException ex) {
            return null; 
        } 
    } 
 
    @Override 
    protected QName getLookupKeyForMessage(MessageContext messageContext) throws Exception {
        return PayloadRootUtils.getPayloadRootQName(messageContext.getRequest().getPayloadSource(), transformerHelper);
    } 
} 
4
CodeRank
This code example shows how to use the following methods:getElementName
    } 
 
    public void testGetElementName_XmlRootElement() { 
        TestObject obj = new TestObject();
        QName controlQname = new QName("someUri", "theRoot");
        assertEquals(controlQname, jaxbIntrospector.getElementName(obj));
    } 
 
    public void testIsElement_XmlElementDecl() { 
        ElementDeclObject elementDeclObject = new ElementDeclObject();
        assertFalse(jaxbIntrospector.isElement(elementDeclObject));
    } 
 
    public void testGetElementName_XmlElementDecl() { 
        ElementDeclObject elementDeclObject = new ElementDeclObject();
        assertNull(jaxbIntrospector.getElementName(elementDeclObject));
    } 
 
    public void testIsElement_JAXBElement() { 
        ElementDeclObject elementDeclObject = new ElementDeclObject();
3
CodeRank
This code example shows how to use the following methods:getElementName
            JAXBContext jaxbContext = getJaxbContext(clazz);
            this.marshaller = jaxbContext.createMarshaller();
            this.marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
            this.jaxbElement = jaxbElement;
            JAXBIntrospector introspector = jaxbContext.createJAXBIntrospector();
            this.name = introspector.getElementName(jaxbElement);
        } 
 
        @Override 
        public QName getName() {
            return name;
        } 
 
        @Override 
        public void writeTo(XMLStreamWriter streamWriter) throws XMLStreamException {
            try { 
                marshaller.marshal(jaxbElement, streamWriter);
            } 
            catch (JAXBException ex) {
                throw new XMLStreamException("Could not marshal [" + jaxbElement + "]: " + ex.getMessage(), ex);
4
CodeRank
See Code Examples for Java 8 JAXBIntrospector Methods: