Here you can find the source of isElement(String contextPath, Object object)
public static boolean isElement(String contextPath, Object object)
//package com.java2s; //License from project: Open Source License import java.util.HashMap; import java.util.Map; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; public class Main { private static Map<String, JAXBContext> contextCache = new HashMap<String, JAXBContext>(); public static boolean isElement(String contextPath, Object object) { try {/*from w ww . j a v a 2s . c o m*/ return object != null && getJAXBContext(contextPath).createJAXBIntrospector().isElement(object); } catch (JAXBException ex) { throw new RuntimeException(ex); } } public static JAXBContext getJAXBContext(String contextPath) throws JAXBException { if (contextCache.containsKey(contextPath)) { return contextCache.get(contextPath); } else { final JAXBContext context = JAXBContext.newInstance(contextPath); contextCache.put(contextPath, context); return context; } } }