Java tutorial
//package com.java2s; 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) { 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; } } }