@XmlRootElement(name="Root")
public class DynamicHead {
@XmlElement(name="head")
public Head head;
@XmlElement(name="body")
public DynamicBody body;
public DynamicHead() {}
}
Hi, I have simple question. I just wanna change the name property of @XmlElement from java code dynamically. How can I do this?
I found this code in XmlElement source,
@Retention(RUNTIME) @Target({FIELD, METHOD})
public @interface XmlElement {
/**
* Name of the XML Schema element.
* <p> If the value is "##default", then element name is derived from the
* JavaBean property name.
*/
String name() default "##default";
Which means, it works on run-time, so isn't it possible to change that value dynamically?
It doesn't matter whether I do coding in this class file or another class file that I use this class. Please help me guys!! :)