Java tutorial
//package com.java2s; import java.lang.annotation.Annotation; import javax.xml.bind.annotation.XmlRootElement; public class Main { public static <T> String getXmlTagNameFromJaxbClass(Class<T> jaxbClass) { String xmlTagName = ""; for (Annotation annotation : jaxbClass.getAnnotations()) { if (annotation.annotationType() == XmlRootElement.class) { xmlTagName = ((XmlRootElement) annotation).name(); break; } } return xmlTagName; } }