Java tutorial
//package com.java2s; import java.lang.reflect.Field; import javax.xml.bind.annotation.XmlAttribute; public class Main { public static String getAttributeName(Field field, XmlAttribute xmlAttribute) { String name = xmlAttribute.name(); if ("##default".equals(name)) { name = null; } if (name == null) { name = field.getName(); } return name; } }