Java XML QName isJAXBElement(Class declaredType, QName name, Class scope, Object value)

Here you can find the source of isJAXBElement(Class declaredType, QName name, Class scope, Object value)

Description

is JAXB Element

License

Open Source License

Declaration

public static <BoundType> boolean isJAXBElement(Class<BoundType> declaredType, QName name, Class<?> scope,
            Object value) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import javax.xml.bind.JAXBElement;

import javax.xml.namespace.QName;

public class Main {
    public static <BoundType> boolean isJAXBElement(Class<BoundType> declaredType, QName name, Class<?> scope,
            Object value) {//w w  w .  ja v  a  2 s.co m
        if (value == null) {
            return false;
        } else if (value instanceof JAXBElement) {
            final JAXBElement<?> element = (JAXBElement<?>) value;

            return element.getName().equals(name) && declaredType.isAssignableFrom(element.getDeclaredType());
        } else {
            return false;
        }
    }
}

Related

  1. hasQName(final Node e, final QName name)
  2. hasQName(Node node, QName qname)
  3. isElementName(Element element, QName name)
  4. isEndElement(final XMLEvent event, final QName name)
  5. isEventStartOrEndElementWithMatchingName(XMLEvent event, QName elementName)
  6. isPrimitiveIdlType(QName idlType)
  7. isPrimitiveType(final QName elementType)
  8. isSameNamespace(QName q1, QName q2)
  9. isSameNamespaceAndDifferentPrefix(QName qName, Element element)