Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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;
    }
}