}
private static void addClassAnnotations(JDefinedClass clazz, QName xmlName, QName xmlType, String[] propertyOrder)
{
// define XmlRootElement class annotation
JAnnotationUse xmlRootElementAnnotation = clazz.annotate(XmlRootElement.class);
xmlRootElementAnnotation.param("name", xmlName.getLocalPart());
String xmlNameNS = xmlName.getNamespaceURI();
if (xmlNameNS != null && xmlNameNS.length() > 0)
{
xmlRootElementAnnotation.param("namespace", xmlNameNS);
}
// define XmlType class annotation
JAnnotationUse xmlTypeAnnotation = clazz.annotate(XmlType.class);
xmlTypeAnnotation.param("name", xmlType.getLocalPart());
String xmlTypeNS = xmlType.getNamespaceURI();
if (xmlTypeNS != null && xmlTypeNS.length() > 0)
{
xmlTypeAnnotation.param("namespace", xmlTypeNS);
}
if (propertyOrder != null)
{
JAnnotationArrayMember paramArray = xmlTypeAnnotation.paramArray("propOrder");
for (String property : propertyOrder)
{
paramArray.param(property);
}
}
// define XmlAccessorType class annotation
JAnnotationUse xmlAccessorTypeAnnotation = clazz.annotate(XmlAccessorType.class);
xmlAccessorTypeAnnotation.param("value", XmlAccessType.FIELD);
}