Here you can find the source of getElementName(Class> claz)
Parameter | Description |
---|---|
claz | the class which has XmlType annotation |
public static String getElementName(Class<?> claz)
//package com.java2s; /*//from ww w .ja va2 s . co m * Copyright (c) 2014 eSOL Co.,Ltd. and Nagoya University * * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php */ import javax.xml.bind.annotation.XmlType; public class Main { /** * Returns the element name of the specified class. * * @param claz * the class which has XmlType annotation * @return the element name of the specified class */ public static String getElementName(Class<?> claz) { try { XmlType annotation = claz.getAnnotation(XmlType.class); if (annotation.name() != null) { return annotation.name(); } } catch (Exception e) { } return claz.getSimpleName(); } }